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.
/android/gradle/wrapper/gradle-wrapper.propertiesfile in your RN project
Find this line that starts with
distributionUrl. Change the gradle version into
In my project, it was:
and I changed it into:
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"
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.