Skip to content Skip to sidebar Skip to footer

Android Studio - Gradle Sync Error On Gradle-diagnostics-x.x.x.jar

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/Contents/gradle/gradle-X.X.X/lib/p

Solution 1:

To solve the Gradle sync error, open gradle-wrapper.properties file and update the Gradle wrapper distribution version from:

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

To:

  • Android Studio 3.4 distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
  • Android Studio 2.3 distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
  • Android Studio 2.2 distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
  • Android Studio 2.1 distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
  • Android Studio 2.0 distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
  • Android Studio 1.5 distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
  • Android Studio 1.3 distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

You can find the latest Gradle wrapper version visiting: https://services.gradle.org/distributions/

EDIT: As a side note, as @SeBsZ suggests, the official repository of the Android Gradle plugin switched from MavenCentral to jCenter (see Bintray blog post).

Make sure your project build.gradle file contains the new repository and the new classpath:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

This is not strictly related to the question problem, but since we are already migrating to the new IDE preview it's better to make sure everything is in place.

Solution 2:

If, like me, you are using an older project then you might still be using the maven repository. Make sure you change the repositories in your top-level build.gradle from maven() to jcenter(). Then make sure you are using the correct dependency as well: classpath 'com.android.tools.build:gradle:1.3.0-beta1' for the new 1.3 preview.

Solution 3:

For me helped to set chmod on the .gradle directory to 777. After this whole Android studio started working correctly.

Solution 4:

I got the same issue after updating android studio to 3.4

I resolve this updatig gradle-wrapper.properties

I had

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

I leave

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

and with this To solve the Gradle sync error.

Solution 5:

This is the weirdest thing ever and I never expected it to work but this:

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

worked and got everything fixed (it was the '\' after https). It does make sense since that is an actual link to a file.

Post a Comment for "Android Studio - Gradle Sync Error On Gradle-diagnostics-x.x.x.jar"