Android Studio - Gradle sync error on gradle-diagnostics-X.X.X.jar

后端 未结 8 2163
轻奢々
轻奢々 2021-01-31 13:28

I\'ve just updated Android Studio and I can\'t sync my project anymore.

The event log reports:

Gradle sync failed: /Applications/Android Studio.app/Conte         


        
8条回答
  •  旧巷少年郎
    2021-01-31 13:56

    Had the same problem with a newly set up Android Studio 2.2.2, gradle wrapper 2.14.1. I loaded the project before i installed the needed android-23 library and installed java after Android Studio installation.

    Error message in Android Studio 2.2.2:

    Error:The specified Gradle distribution
    'https://services.gradle.org/distributions/gradle-2.14.1-all.zip' does 
    not appear to contain a Gradle distribution.
    

    Error message in cmd:

    projectfolder> gradlew
    Exception in thread "main" java.lang.NullPointerException
    at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:34) 
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:25)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    

    When i used gradle from cmd however it worked

    projectfolder> set PATH=%PATH%;C:\AndroidStudio2.0\gradle\gradle-2.14.1\bin\
    projectfolder> set GRADLE_HOME=C:\AndroidStudio2.0\gradle\gradle-2.14.1\bin\
    projectfolder> cd C:\projectfolder\
    projectfolder> gradle
    BUILD SUCCESSFUL
    

    In cmd i see that the gradle versions and android sdk version were correct

    C:\>set | find "JAVA_HOME"
    JAVA_HOME=C:\Java\jdk1.8.0_111\
    

    However in C:\Users\.AndroidStudio2.2\system\log\idea.log it said something else:

    2016-11-29 16:04:10,597 [ 107684]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/AndroidStudio2.0/jre 
    2016-11-29 16:04:10,597 [ 107684]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/AndroidStudio2.0/jre 
    

    After messing up Android Studio config files i ended up reinstalling everything in correct order (Java, Android Studio, Project) and it worked.

提交回复
热议问题