N
N
Nikita Andreevich2020-08-16 17:43:24
React Native
Nikita Andreevich, 2020-08-16 17:43:24

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


I bought a laptop while working only with expo, now there is a need to file a project on cli. This I mean that it’s possible that I didn’t install something root (that is, there is nothing that worked before and now doesn’t work. I’m trying to run cli for the first time on this computer.)

Next, I’ll describe what I did and what answers I received in the console.
Added all necessary variables and path (JAVA_HOME, ANDROID_HOME).

I write I npx react-native run-android
get:
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


Write : $ ./gradlew.bat app:installDebugor ./gradlew clean
Receive :
←[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


It also seemed strange to me that when executing the command npm i -g openjdk8
I get an error:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/openjdk8 - Not found

Although I installed the jdk manually.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LinkVP, 2020-08-16
@NikitosAndreevich

You don't have jdk installed. If you do not want to deal with the installation, then run it from the console: react-native doctorand 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 question

Ask a Question

731 491 924 answers to any question