How solve (Could not initialize class org.codehaus.groovy.reflection.ReflectionCache) issue in react native

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:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip

and I changed it into:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

That's it.


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"


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

from:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip

to:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

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.