Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
Solution 1
I finally fixed it by uninstalling anything beyond Java 8. It seems like Android Studio doesn't like upgraded Java. Everything works now.
Solution 2
I had the same problem a few days ago. I fixed it by updating the Gradle version in android/gradle/wrapper/gradle-wrapper.properties
to :
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
For it to update, you just have to flutter run
.
Solution 3
I fixed it by updating gradle version.
Go to android->gradle->wrapper->gradle-wrapper.properties file and update gradle to latest version.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
Go to android->build.gradle file
classpath 'com.android.tools.build:gradle:4.2.0'
flutter clean
flutter run
Pamela
Updated on December 25, 2022Comments
-
Pamela over 1 year
I've been using Flutter on Android Studio. Today, I updated it and everything went downhill.
I've been having different errors throughout my attempt to fix this.
First error: could not initialize class org.codehaus.groovy.runtime.invokerhelper
Second error: could not initialize class org.codehaus.groovy.reflection.ReflectionCache
Anyways, I've been researching and I've done the following
- Updated Java SDK.
- Updated JRE
- Added necessary paths to environment variables
- Updated Gradle
But nothing is still working and I cannot run my project. Please help?