This error occurred when trying to run npx react-native run-android
error encountered
Asked
Active
Viewed 3.1k times
0

AMAL MOHAN N
- 1,416
- 2
- 14
- 26
-
Did you follow the steps outlined in the link? – ivanmoskalev Feb 12 '21 at 17:08
-
1@ivanmoskalev i've resolved the issue, thanks for the reply – AMAL MOHAN N Feb 12 '21 at 17:29
-
@AMALMOHANN how? – chirag prajapati Apr 24 '21 at 04:06
1 Answers
5
I've figured a way to resolve this issue. To resolve this please follow the following steps. Here we'll be trying two steps, if you're lucky the issue will resolve in first step it self.
- go to the project folder
- open cmd in that folder (if you're using vscode use cntrl + ~ to open terminal)
cd android
(you can also go directly to project/android folder and open cmd there)- now run
gradlew clean
(for modern versions:./gradlew clean
) - if you get permission errors then try
chmod +x gradlew
If your issue is resolved have a good coding else continue. Most common error is
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
for resolving this please following the below steps,
- Please download JDK version 14 or above
JDK Download link:
https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
- go to
your_project/android/gradle/wrapper/gradle-wrapper.properties
- change to gradle version 6.3 or above
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
- now run
npx react-native run-android
this worked for me.

Community
- 1
- 1

AMAL MOHAN N
- 1,416
- 2
- 14
- 26