0

Error message: I have been trying to run react native code on my machine. I have a android emulator up and running but the app is not getting launched.

I have done npm run

and npm run adb: android

npm run adb:android


> quickSellIos@0.5.1 adb:android
> adb reverse tcp:8081 tcp:8081 && react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1257 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)

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.2/userguide/gradle_daemon.html
Process command line: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx4096M -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /Users/priyamshah/.gradle/wrapper/dists/gradle-7.2-all/260hg96vuh6ex27h9vo47iv4d/gradle-7.2/lib/gradle-launcher-7.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.2
Please read the following process output to find out more:
-----------------------
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


* 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

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 app:installDebug -PreactNativeDevServerPort=8081

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.2/userguide/gradle_daemon.html
Process command line: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx4096M -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /Users/priyamshah/.gradle/wrapper/dists/gradle-7.2-all/260hg96vuh6ex27h9vo47iv4d/gradle-7.2/lib/gradle-launcher-7.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.2
Please read the following process output to find out more:
-----------------------
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.




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

I launched the emulator and then tried the command npm run adb:android but it throws some error. Previously it was working on my system.

Priyam
  • 124
  • 3
  • 9

2 Answers2

1

Try top put this: org.gradle.jvmargs=-Xmx6408m -XX:MaxMetaspaceSize=6408m -XX:+HeapDumpOnOutOfMemoryError in your gradle.properties file. I used this as the source to the answer.

  • I am new so please if you can help: to build the app -> I will first launch the emulator from android studio (won't run or build it else it will be a static build), then in terminal I will write `npm run adb:android` ?? and it will launch the app automatically. Am I correct?? or there are some more steps or setup process? Thanks for the help. (adding this line also does not work, no error it launches terminal and opens metro but nothing else) – Priyam Mar 25 '23 at 03:20
  • You should run ```npx react-native run-android```. To check more details, check this [link](https://reactnative.dev/docs/environment-setup). – Gabriel Menezes da Silva Apr 05 '23 at 20:03
  • thanks the error is resolved. – Priyam Apr 06 '23 at 23:45
  • @GabrielMenezesdaSilva: you could take a look here: https://stackoverflow.com/questions/77028267/macos-react-native-this-problem-might-be-caused-by-incorrect-configuration-of-th – Paul Sep 02 '23 at 12:25
0

MaxPermSize=512m. This option was removed in JDK 8 and later versions, and you're using JDK 17.0.1.

Try with JDK 11, as far as I know that's the version RN supports.

Varin
  • 2,354
  • 2
  • 20
  • 37
  • Till now it was working fine. Then somehow it started giving this error – Priyam Mar 24 '23 at 08:43
  • @varin: you could take a look here: https://stackoverflow.com/questions/77028267/macos-react-native-this-problem-might-be-caused-by-incorrect-configuration-of-th – Paul Sep 02 '23 at 12:25