当我运行“npx react-native run-ad”时,新鲜的 React Native App 不会安装在模拟器上

Posted

技术标签:

【中文标题】当我运行“npx react-native run-ad”时,新鲜的 React Native App 不会安装在模拟器上【英文标题】:Fresh React Native App won't install on emulator when I run "npx react-native run-ad" 【发布时间】:2021-12-31 16:30:10 【问题描述】:

我有一个使用“npx react-native init LatinApp”命令使用 React Native CLI 构建的全新应用程序,并且在任何文件中都没有进行任何编辑。 当我在 cmd 中运行“npx react-native run-android”命令时,它会在另一个 cmd 中打开 Metro,但会引发以下错误。 (我以管理员权限运行我的 cmd,并且 android 文件夹中的所有文件都启用了完全访问权限)

C:\Users\eminn\Desktop\projects\LatinApp>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 870 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...

> Task :app:processDebugMainManifest FAILED
Error 'C:\Users\eminn\Desktop\projects\LatinApp\android\app\build\outputs\logs\manifest-merger-debug-report.txt (Access is denied)' while writing the merger report file, build can continue but merging activities will not be documented
11 actionable tasks: 4 executed, 7 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> java.io.FileNotFoundException: C:\Users\eminn\Desktop\projects\LatinApp\android\app\build\intermediates\manifest_merge_blame_file\debug\manifest-merger-blame-debug-report.txt (Access is denied)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> java.io.FileNotFoundException: C:\Users\eminn\Desktop\projects\LatinApp\android\app\build\intermediates\manifest_merge_blame_file\debug\manifest-merger-blame-debug-report.txt (Access is denied)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s

    at makeError (C:\Users\eminn\Desktop\projects\LatinApp\node_modules\execa\index.js:174:9)
    at C:\Users\eminn\Desktop\projects\LatinApp\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (C:\Users\eminn\Desktop\projects\LatinApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\eminn\Desktop\projects\LatinApp\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

【问题讨论】:

能否添加 package.json? 你有反应原生环境的错误。首先添加 react 原生环境。 【参考方案1】:

问题在于 AVG Antivirus,它出于某种原因将“manifest-merger-blame-debug-report.txt”标记为木马。禁用它,构建成功完成。

【讨论】:

以上是关于当我运行“npx react-native run-ad”时,新鲜的 React Native App 不会安装在模拟器上的主要内容,如果未能解决你的问题,请参考以下文章

我已经按照 react-native 文档开始使用,但是在运行 npx react-native run-android 后我一直无法启动默认应用程序本身

npx react-native run-android:E/Device:同步期间出错:EOF

为啥当我将我的国际象棋项目作为可运行的 jar 文件运行时,我得到一个奇怪的行为,而当我在 eclipse 中运行它时,一切正常?

当我从模块内部运行文件时,文件导入正在工作,但当我通过从外部导入模块来运行文件时则不起作用

当我在 Eclipse 中运行 hadoop 作业时出现异常

当我的应用程序无法在调试模式下运行,但 exe 文件可以正常运行时,这意味着啥?