Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Please make changes as per below to resolve this error.
Install Java SDK version: 14 or above.
JDK Download link: https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
In
gradle-wrapper.properties
please use grade version 6.3 or above.
For e.g:distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
-
This is because of the gradle version.
-
Go to:
gradle/wrapper/gradle-wrapper.properties
. -
Change a version of the course by this:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
The console outputs:
Welcome to Gradle 6.3!
Here are the highlights of this release:
- Java 14 support
- Improved error messages for unexpected failures
For more details see https://docs.gradle.org/6.3/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
First watch this and try reinstall - https://youtu.be/trHinrIm6DM
After if you get "Could not initialize class org.codehaus.groovy.runtime.InvokerHelper"
1.install Java SDK 14 and update env path.
2."[Your RN or Flutter Project Folder]\android\gradle\wrapper\gradle-wrapper.properties" this file edit as ...(upgrade gradle version)
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
3.run gradlew in cmd path "[Your RN or Flutter Project Folder]\android\"
4.it takes time.after if shows "BUILD SUCCESSFUL" you can "flutter run" in ur project folder
Yeah It's work 👍