Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 intellij code example
Example 1: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
This is because of the gradle version:
In your project
go to: gradle / wrapper / gradle-wrapper.properties /
change the version:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
Source
https://stackoverflow.com/questions/35000729/android-studio-could-not-initialize-class-org-codehaus-groovy-runtime-invokerhel
Example 2: Could not initialize class org.codehaus.groovy.vmplugin.VMPluginFactory
On your Android or Intellij Project, go to:
yourprojectname/gradle/wrapper/gradle-wrapper.properties.
Property distributionUrl should be:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
If it's an older version then change it, run ./gradlew clean build and try again.
Example 3: java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
It's probably because you use Gradle as the build system and JDK14
and the Gradle version is old. Reference:
https://github.com/gradle/gradle/issues/10248
If you use Gradle Wrapper then refer to
$PROJECT_ROOT/gradle/wrapper/gradle-wrapper.properties.
Property distributionUrl should be:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
If it's an older version then change it, run ./gradlew clean build
and try again.
Example 4: could not initialize class org.codehaus.groovy.reflection.reflectioncache intellij
could not initialize class org.codehaus.groovy.reflection.reflectioncache intellij