Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidStudio - Gradle Refresh Failed

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'
}
like image 494
Rroia Avatar asked Oct 20 '13 19:10

Rroia


People also ask

How to fix Gradle not responding in Android Studio?

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” mean in Android Studio?

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.

How do I restart a Gradle project in Ubuntu?

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. ...

What is Gradle in Android Studio?

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.


1 Answers

I was able to solve the problem. I don't know what caused the bug, but its gone. Steps to fix:

  • Backup and delete existing project
  • Deinstalling android studio 0.3
  • Deleting .gradle/ and .androidstudio/ in user directory
  • Installing android studio 0.2.X
  • Patching android studio to 0.2.9
  • Reimporting code backup
like image 159
Rroia Avatar answered Oct 06 '22 16:10

Rroia