Skip to content Skip to sidebar Skip to footer

Android Studio 1.3.2 Error When Refreshing Gradle

I generated build.gradle file from eclipse and import it to android studio. However, it returns error after 'refreshing gradle' : Gradle sync failed: Could not find com.android.to

Solution 1:

Don't confuse the gradle-plugin for Android and gradle. They are different. You can find more info about the android plugin here

With the classpath inside your gradle files, you set the version of the android plugin for Gradle.

Change your classpath using:

classpath 'com.android.tools.build:gradle:1.3.1'

instead of:

classpath 'com.android.tools.build:gradle-1.12'

In the gradle-wrapper.properties file you set the version of the Gradle. For example the 2.4 version.

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

Solution 2:

I recommend you to use gradle 2.4, you can download it here. Then, extract the downloaded file into C:\Program Files\Android\Android Studio\gradle. After that, open File > Settings from Android Studio. On the searchbox, type gradle and search.

enter image description here

Open build.gradle from the main project and type classpath 'com.android.tools.build:gradle:1.3.0' under dependencies:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files
    }
}

Finally, rebuild your project in Build > Rebuild project.

Post a Comment for "Android Studio 1.3.2 Error When Refreshing Gradle"