$ npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 864 file(s) to forward-jetify. Using 4 workers... info Starting JS server... info Launching emulator... error Failed to launch the emulator. Reason: Could not start an emulator within 30 seconds. warn Please launch an emulator manually or connect a device. Otherwise, the app may fail to launch. info Installing the app...

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 1m 23s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

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 1m 23s

at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (E:\work\react-native\AwesomeProject1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)

Solution 1

I think I had the same issue. After installing RN (May 20th, 2020), I bumped into this error. I found this solution on https://github.com/gradle/gradle/issues/10248.

In short:

  1. Go to /android/gradle/wrapper/gradle-wrapper.properties file in your RN project

  2. Find this line that starts with distributionUrl. Change the gradle version into gradle-6.3-all.zip.

In my project, it was:


and I changed it into:


That's it.

Solution 2

I had the same error on Mac OS and React Native v0.62.

Apply these instructions correctly: React native environment setup

Adding this variable solved my problem:

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"

Solution 3

In the React Native version 0.62.x even the initialized application is not ready for a development build.

I change the Gradle version to the latest and I could to have a clean build, so change this file:

// this file => /android/gradle/wrapper/gradle-wrapper.properties





Pay Attention: The latest version of the Gradle for my time is 6.5. when you are reading this answer please check this link to see the latest version number of the Gradle.

Update Mar 31, 2022


Solution 4

I fixed this by these steps:

  1. install android studio 3.5 (or later)
  2. install java 1.8
  3. if you have java JDE 14.x.x you have to remove its folder from library/java/JavaVirtualMachines/jdk-14.x.x.jdk (on mac os)
  4. install an older version of JDE (I installed 11.0.6)
  5. npm run android!

Solution 5

Just follow these 2 steps only and take your coffee.

  1. Navigate to 'android' > gradle > wrapper > gradle-wrapper.properties

  2. Change 'distributionUrl' from old to >


Solution 6

This Error occurs when the gradle version you used is not compatible on your environment, so you just need to update your gradle version to latest Gradle Versions, just go to: /android/gradle/wrapper/gradle-wrapper.properties to your project file.

Solution 7

Auguest 2021

I was using JDK 16.0.1 and faced this issue. So, for JDK 16.0.1 you need 7.0 version of gradle.

I fixed it by going to /android/gradle/wrapper/gradle-wrapper.properties and changing




Solution 8

If you are a macOS user then you should install

brew cask install adoptopenjdk/openjdk/adoptopenjdk8
brew cask install android-platform-tools

update your .bash_profile

nano ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

This would resolve your problem. If you are working on a legacy codebase then changing the distribution URL would lead to other problems. It usually happens because of mismatching java versions.

Solution 9

It's probably because you use Gradle as the build system and JDK14 and the Gradle version is old. Reference:

If you use Gradle Wrapper then refer to


Property distributionUrl should be:


If it's an older version then change it, run ./gradlew clean build and try again.

Solution 10

It is because your Gradle version is not supported by the Java JDK. If you use the JDK version 15.0.2 then you need to Gradle version change 6.6.1 or 6.7

To Change the Gradle Version in Android Studio.


Open this file and set this


then this problem will be solved.

To check the java JDK version.

open cmd. run echo %JAVA_HOME%

Then you can also search on google to check the supported version of Gradle to the JDK.

Solution 11

updating JAVA_HOME works for me in mac OS

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"

Solution 12

This issue is caused by incorrect version of graddle. so to fix this follow these steps

  • Make sure you have Android studio installed and SDK is setuped from Android studio menu Tool-> SDK Manager you can setup SDK, install latest SDK if you are using latest version of React Native .
  • From Android Studio menu Tools > AVD Manager Setup one device and download the image. and test it to see that emulator is running OK.
  • Make Sure JDK is installed for latest react native install latest JDK : https://www.oracle.com/java/technologies/javase-downloads.html
  • Next from Android Studio menu File > New > new project create one dummy project aka Hello world and build make sure all android studio issues resolved and your Android studio hello world app is running on emulator.
  • Now time to fix your react native app. Stop your Android studio hello world app and keep the emulator running.
  • Locate your Android studio hello world app on your system and go to gradle\wrapper folder and copy the gradle-wrapper.properties file

example in windows case my hello world app is located in my documents: C:\Users\Superman\Documents\android\hello world\gradle\wrapper

  • Next go to your react native app folder like : myReactApp\android\gradle\wrapper and paste the gradle-wrapper.properties file you copied from your Android studio hello world app.
  • finally in your terminal execute : npx react-native run-android

Solution 13

I have the same issue with new project and windows. I try all these way but it doesn'. Ridiculously, I move java/jdk folder from C:\Program Files to another dir in D:\ and it works like a charm. May be it's useful.

Solution 14

December 2021

If you're using the latest version of Java Development Kit, you'll need to change the Gradle version of your project so it can recognize the JDK. You can do that by going to {project root folder}\android\gradle\wrapper\gradle-wrapper.properties and changing the distributionUrl value to upgrade the Gradle version. You can check out here the lastest releases of Gradle.

Solution 15

If you're looking for a solution for a Java/Kotlin Core Android project and not a React Project because i was also facing this problem in my core android project so here you go... None of the above solutions worked for me. So basically the idea is to Change the version of gradle. How to do that you ask? Follow these steps:

  1. File>Project Structure
  2. Select SDK Location
  3. You will find something written as "JDK was moved to Gradle Settings". Click on Gradle Settings.
  4. Use Gradle Version 11.0
  5. Sync the project again.

And there you go! A successfully built project! :)