android 无法安装应用程序React Native VSCODE

a1o7rhls  于 2022-12-09  发布在  Android
关注(0)|答案(1)|浏览(210)

我正在尝试让npx react-native run-android工作。我已经尝试搜索stackoverflow,但还没有找到一个有效的答案。我已经尝试使用EXPO CLI,现在我正在使用REACT NATIVE CLI,结果相同。我只是尝试设置一个空白应用程序,这样我就知道它能工作。

Info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html
Process command line: D:\JAVA\bin\java.exe -XX:MaxMetaspaceSize=512m -Xmx2048m -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp C:\Users\Owner\.gradle\wrapper\dists\gradle-7.5.1-all\1ehga6e77gqps5uk2kc5kf1vc\gradle-7.5.1\lib\gradle-launcher-7.5.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.5.1
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

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

at makeError (D:\ReactNativeCLITutorial\MyNewsletter\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at D:\ReactNativeCLITutorial\MyNewsletter\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16    
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (D:\ReactNativeCLITutorial\MyNewsletter\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (D:\ReactNativeCLITutorial\MyNewsletter\node_modules\@react-native-community\cli\build\index.js:142:9)
2izufjch

2izufjch1#

这个错误的发生基本上是由于您的android开发环境设置,
我建议你试试这个方案;


安装JAVA开发工具包并添加环境变量的路径,同时确保您的磁盘上有足够的空间!

相关问题