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/plugins/gradle-diagnostics-X.X.X.jar (No such file or directory)
For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.
Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.
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:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With