简体   繁体   English

无法安装应用程序 React Native VSCODE

[英]Failed to install the app React Native VSCODE

I'm trying to get npx react-native run-android to work.我正在尝试让 npx react-native run-android 工作。 I've tried searching through stackoverflow but haven't found an answer that has worked yet.我尝试通过 stackoverflow 进行搜索,但尚未找到有效的答案。 I've tried using EXPO CLI and now I'm using REACT NATIVE CLI with the same result.我试过使用 EXPO CLI,现在我使用 REACT NATIVE CLI 得到了相同的结果。 I'm just trying to set up a blank application so I know it works.我只是想设置一个空白应用程序,所以我知道它可以工作。

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)   

This error is happening basically because of your android development environment settings,发生此错误主要是因为您的 android 开发环境设置,

I would recommend you to try this solutions;我建议你试试这个解决方案;

环境变量

平台工具 install JAVA Development kit and add the path to the environmental variables and also make sure you have enough space on your disk!安装JAVA开发包并添加环境变量的路径,还要确保你的磁盘空间足够!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM