Answer the question
In order to leave comments, you need to log in
Why am I getting this error gradlew.bat app:installDebug -PreactNativeDevServerPort=8081?
Hello.
When I run the command npm run android
I get an error:
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
npx react-native run-android
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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 1s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nikba\AppData\Roaming\npm-cache\_logs\2020-08-16T14_19_16_672Z-debug.log
$ ./gradlew.bat app:installDebug
or ./gradlew clean
←[1A←[1m<←[0;1m-------------> 0% INITIALIZING [45ms]←[m←[38D←[1B←[1A←[0K
←[31mFAILURE: ←[39m←[31mBuild failed with an exception.←[39m
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* Try:
Run with ←[1m--stacktrace←[m option to get the stack trace. Run with ←[1m--info←[m or ←[1m--debug←[m option to get more log output. Run with ←[1m--scan←[m to get full insights.
* Get more help at ←[1mhttps://help.gradle.org←[m
←[31;1mBUILD FAILED←[0;39m in 1s
←[0K
←[1A←[1m<←[0;1m-------------> 0% WAITING←[m←[26D←[1B←[1A←[2K
npm i -g openjdk8
npm ERR! 404 Not Found - GET https://registry.npmjs.org/openjdk8 - Not found
Answer the question
In order to leave comments, you need to log in
You don't have jdk installed. If you do not want to deal with the installation, then run it from the console: react-native doctor
and it will install everything automatically.
Read about the tool
Ps I checked the doctor's performance on linux, there may be problems on windows, so you may have to set the handles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question