0

I'm trying to get npx react-native run-android to work. I've tried searching through stackoverflow but haven't found an answer that has worked yet. I've tried using EXPO CLI and now I'm using REACT NATIVE CLI with the same result. 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)   
Songlore
  • 1
  • 2

1 Answers1

0

This error is happening basically because of your android development environment settings,

I would recommend you to try this solutions;

Environmental Variables

Platform-tools install JAVA Development kit and add the path to the environmental variables and also make sure you have enough space on your disk!

HanKBeatz
  • 152
  • 1
  • 1
  • 10
  • I had already done that but thank you for the recommendation. What worked was using Expo Snack. There's something wrong with my computer. It's from 2014 and has a nearly full C drive. – Songlore Dec 07 '22 at 21:30
  • yeah you need a lot of space to run android emulator, – HanKBeatz Dec 08 '22 at 03:21