Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1
Android Studio 0.5.0 requires gradle-plugin 0.9.0
The gradle-plugin 0.9.0 works with Gradle 1.10 or Gradle 1.11
Modify your build.gradle script as suggested by Cedric.
There is a relation between gradle-plugin and the gradle version. For example
UPDATED TO 27/11/2015:
com.android.tools.build:gradle:0.6.+ -> gradle 1.8
com.android.tools.build:gradle:0.7.+ -> gradle 1.9
com.android.tools.build:gradle:0.8.+ -> gradle 1.9/1.10
com.android.tools.build:gradle:0.9.+ -> gradle 1.10/1.11
com.android.tools.build:gradle:0.10.+ -> gradle 1.10/1.11/1.12
com.android.tools.build:gradle:0.11.+ -> gradle 1.10/1.11/1.12
com.android.tools.build:gradle:0.12.+ -> gradle 1.10/1.11/1.12
com.android.tools.build:gradle:0.13.+ -> gradle 2.1
com.android.tools.build:gradle:0.14.+ -> gradle 2.1
com.android.tools.build:gradle:1.0.+ -> gradle 2.2.1-2.3
com.android.tools.build:gradle:1.1.+ -> gradle 2.2.1-2.3
com.android.tools.build:gradle:1.2.+ -> gradle 2.2.1+
com.android.tools.build:gradle:1.3.+ -> gradle 2.2.1+
com.android.tools.build:gradle:1.3.+ -> gradle 2.2.1+
com.android.tools.build:gradle:1.5.+ -> gradle 2.2.1+
com.android.tools.build:gradle:2.0.+ -> gradle 2.10.0+
You can find gradle version used in your project in the file gradle/wrapper/gradle-wrapper.properties
Also there is a relation between gradle-plugin and the IDE version.
Android Studio 0.3.x -> gradle-plugin 0.6
Android Studio 0.4.x -> gradle-plugin 0.7
Android Studio 0.4.3+ -> gradle-plugin 0.8
Android Studio 0.5.x -> gradle-plugin 0.9
Android Studio 0.5.8 -> gradle-plugin 0.9.+ or 0.10.+
Android Studio 0.5.9 -> gradle-plugin 0.9.+ or 0.10.4+
Android Studio 0.6.x -> gradle-plugin 0.11.+
Android Studio 0.8.x -> gradle-plugin 0.12.+
Android Studio 0.8.11+ -> gradle-plugin 0.13.+ / gradle-plugin 0.12.+
Android Studio 0.9.x -> gradle-plugin 0.14.+
Android Studio 1.0.0 -> gradle-plugin 1.0.0
Android Studio 1.1.x -> gradle-plugin 1.0.0/ 1.1.x / 1.2.x
Android Studio 1.2.x -> gradle-plugin 1.0.0/ 1.1.x / 1.2.x
Android Studio 1.3.x -> gradle-plugin 1.0.0/ 1.1.x / 1.2.x / 1.3.x
Android Studio 1.4.x -> gradle-plugin 1.0.0/ 1.1.x / 1.2.x / 1.3.x
Android Studio 1.5.x -> gradle-plugin 1.0.0/ 1.1.x / 1.2.x / 1.3.x / 1.5.x
Android Studio 2.0.x -> gradle-plugin 2.0.0
Also gradle 1.12 requires Android Studio 0.5.8+
For updated news you can check this link: http://tools.android.com/recent
For updated doc about the gradle plugin check here.
If you change your plugin version, check compatibility, and then click sync project with your gradle files.It will download a new plugin version if you need it.
To fix it, open file called build.gradle
in the project root, and change gradle version there to 0.9.+.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
To be repeated for each project ;(
If you then get a message like "Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult
".
Go to you project_folder/gradle/wrapper
directory and edit Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult'.
file changing the distributionUrl
to
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
After upgrade to version 0.8.1 (full download and copy SDK folder over), had to have new version of gradle installed by IDE (using the "Fix it" link a couple of time :S ), and modifing the "android" section of the gradle file in project folder from 19.0 to 19.1, as below: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' } } apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:support-v4:19.1.0'
}
I had the same error, but already had
classpath 'com.android.tools.build:gradle:0.9.+'
set like this, as Cedric Simon suggested. Thanks to the comment of mattblang, I tried to change it to 0.9.0 and refreshed it
for those who don't know, where the refresh button is, look below:
Afterwards I tried what happens when I change it back to 0.9.+ and refresh again...and it still works.
So I assume, only pressing the refresh button would have sufficed.
I faced Same problem Migrating into gradle version 1.0.0.. This solution helps me and save the date..
Update Plugin and Gradle Version Numbers
The Android Gradle plugin version is typically listed in the top level build.gradle file in the project, and can be updated as follows:
Let me consider i have version 0.8.. show my build.gradle(project root folder/build.gradle) shows
dependencies { classpath 'com.android.tools.build:gradle:0.8.+' }
remove the old version(0.8) and add new version 1.0.0 like this
dependencies { classpath 'com.android.tools.build:gradle:1.0.0' }
And also change the gradle/wrapper/gradle-wrapper.properties:
remove the old distributionUrl and add new url
distributionUrl=http://services.gradle.org/distributions/gradle-2.2.1-all.zip
and change the runProguard in project root/app/build.gradle
BEFORE:
buildTypes { release { runProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
AFTER:
buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
For more information : Migrating gradle Project(click here)