I was using the up to date version of android studio to build my app for android. The gradle wrapper set up the gradle installation and the project was build without errors.
Eventually I started getting one error each time I restarted.
Gradle: A problem occurred configuring project ':App'.
Could not resolve all dependencies for configuration ':App:classpath'. Could not resolve com.android.tools.build:gradle:0.5.+. Required by: App:App:unspecified
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
The issue could be fixed by executing gradlew again and builds went fine. But after the 0.3 android studio update and android plugin update to 0.6.+ I can't even execute gradlew anymore without getting this error message.
I tried uninstalling android studio with all its configuration files, deleted the .gradle folders in the project and home directory and even the .m2 repository. I can't even start a new android project, it fails with the same error, so there should be no issue with my build.grade
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 18
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'org.jsoup:jsoup:1.7.2'
}
In this click on Invalidate Caches and Restart option to Restart your Android Studio project. After restarting your Android Studio the Gradle issue will be fixed. This issue will not be solved if the folder containing Gradle files is deleted or corrupted. In such a case, you have to download new files for Gradle.
What does the error, Gradle project sync failed Please fix your project and try again” in Android Studio mean? Gradle sync is one of the Gradle tasks which checks for all the dependencies present in the build. Gradle files.
1 Method 1: Restarting your project using Invalidate Caches and Restart option. In this method, we will be restarting our project using Invalidate Caches and Restart option. ... 2 Method 2: Sync your project with Gradle files. ... 3 Method 3: Deleting and installing new Gradle files. ...
Gradle is used in Android Studio to develop the .APK files which are non-other than the Apps on our mobile phones. The Gradle combines all the Java and XML files into dex files and with the help of its tools produces an APK file.
I was able to solve the problem. I don't know what caused the bug, but its gone. Steps to fix:
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