Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

后端 未结 16 1266
一整个雨季
一整个雨季 2020-12-02 11:29

I am new in Android Studio. After setup, When I am trying to import an application I am getting that error So that gradle not able to build.

Error:Could not

相关标签:
16条回答
  • 2020-12-02 12:18

    gradle-wrapper.properties please use grade version 6.3 or above

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

    ../android/gradle/wrapper/gradle-wrapper.properties

    0 讨论(0)
  • 2020-12-02 12:21

    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

    0 讨论(0)
  • 2020-12-02 12:23

    (Solution) I tried my first flutter app in android studio , i was getting same error " Could not initialize class org.codehaus.groovy.runtime.InvokerHelper"

    open build.gradle and update dependencies

        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    

    or just hover over com.android.tools.build:grandle:(your-version)

    0 讨论(0)
  • 2020-12-02 12:27

    I face this issue when I was Building my Flutter Application. This error is due to the gradle version that you are using in your Android Project. Follow the below steps:

    • Install jdk version 14.0.2 from https://www.oracle.com/java/technologies/javase-jdk14-downloads.html .

    • If using Windows open C:\Program Files\Java\jdk-14.0.2\bin , Copy the Path and now update the path ( Reffer to this article for updating the path : https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/ .

    • Open the Project that you are working on [Your Project]\android\gradle\wrapper\gradle-wrapper.properties and now Replace the distributionUrl with the below line:

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

    Now Save the File (Ctrl + S), Go to the console and run the command

    flutter run

    It will take some time, but the issue that you were facing will be solved.

    0 讨论(0)
  • 2020-12-02 12:29

    What was helpful for me (MacBook):

    • first go to File -> Invalidate Caches / Restart -> Invalidate and Restart
    • then check the value of JAVA_HOME enviroment variable, by calling echo $JAVA_HOME (it should be equal to "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home")
    • if it is not, change its value by calling export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
    0 讨论(0)
  • 2020-12-02 12:29

    I faced this issue because of lower version of Jdk. Previously I installed Jdk 1.7 and Android Studio 1.5.1, I got this issue. If you install Android Studio 1.5.1 or above JDK 1.8 required

    So Installing JDK 1.8 solved this issue.

    0 讨论(0)
提交回复
热议问题