23

I installed Android Studio 0.5.1 and my project is not working any more. Error it provides is:

The project is using an unsupported version of Gradle. Please use version 1.10.

I tried to change settings in gradle-wrapper.properties and gradle.build file, but without luck.

gradle-wrapper.properties file:

#Wed Mar 12 11:11:46 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

My gradle.build looks like this:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'

    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'de.timroes.android:EnhancedListView:0.3.1@aar'
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }


        instrumentTest.setRoot('tests')

        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

How can I force Android Studio to download gradle 1.10 or 1.11?

Thanks!

Draško
  • 2,119
  • 4
  • 41
  • 73
  • I also removed C:\Users\{user}\.gradle folder, but in its \caches after clearing project, I found only 1.9 folder. I expect, since I changed distributionUrl parameter, there should be 1.11, right? – Draško Mar 12 '14 at 18:52
  • Is there a typo in your error message in your question? You say "...Please use version 1.10."; is it actually "...Please use version 1.11."? Also, did you have it use the wrapper when you imported your project, or did you import using a locally-installed Gradle distribution? – Scott Barta Mar 12 '14 at 19:31
  • No, message is "...Please, use version 1.10.". My project worked great in previous version of Android Studio (or maybe version prior to previous, can't remember now), I just upgraded it. Oh, I changed distributionUrl to http\://services.gradle.org/distributions/gradle-1.10-all.zip, but nothing changed. – Draško Mar 12 '14 at 19:36
  • Does your project have multiple modules? Is one of those modules still linking v0.8.X of the plugin? The build file you posted is 0.9.+, which should be demanding Gradle 1.11, not 1.10. – Scott Barta Mar 12 '14 at 19:41
  • No, project doesn't containt any multiple modules. – Draško Mar 12 '14 at 20:56

7 Answers7

27

Try this:

Modify the gradle-wrapper.properties

distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip

and your build.gradle

compileSdkVersion 19 
buildToolsVersion "19.0.1"

running:./gradlew clean assemble in the terminal

Also you may want to read this

glhf

Update, he solved it:

https://plus.google.com/101589574290830309525/posts/7YzcE6YpfwK

I finally solved it, by removing .idea folder and all .iml files and imported project as new one.

douglaszuniga
  • 331
  • 2
  • 4
  • I thougth that this would help me, since ./gradlew clean assemble started downloading gradle 1.11 but I was still receiving the same message "The project is using an unsupported version of Gradle. Please use version 1.10.". I've changed distributionUrl to 1.10, started clean assemble but without any luck. Also, I downloaded both 19.0.1 and 19.0.3 build tools and without any luck. – Draško Mar 13 '14 at 08:22
  • Just modifying the gradle-wrapper.properties like you said to do worked for me. I didn't have to remove the .idea folder. – Ben Kane Apr 02 '14 at 15:06
  • I fixed it by going into the .idea/ folder, opening the ``gradle.xml`` file and updating the ``gradleHome`` line with the right version, then clean and rebuild the project. – jbiral Jan 22 '16 at 00:27
3

I encountered this problem when i tried to import an gradle project from github. There was no gradle wrapper in the project. I created a new android project in android studio and copied gradle folder to the project that i get from github. Then in the settings of the project in gradle section,i chose the "use default gradle wrapper". Then problem is solved.

Murat
  • 3,084
  • 37
  • 55
2

Try to change buildToolsVersion to 19.0.3 and don't forget to install it in the sdk manager

curioushikhov
  • 2,461
  • 2
  • 30
  • 44
  • I did it, but still couldn't pass that error message Gradle is giving to me. – Draško Mar 13 '14 at 08:22
  • May be it is old wrapper? Try to replace it with one from sdk templates – curioushikhov Mar 13 '14 at 08:35
  • replace files of project with those in path android-sdk/tools/templates/gradle/wrapper – curioushikhov Mar 13 '14 at 09:10
  • could you please tell what is written in your gradle-wrapper.properties file for distributionUrl in path android-sdk/tools/templates/gradle/wrapper ? – Draško Mar 13 '14 at 09:20
  • 1
    Same as in your question. One more idea - did you try to assemble project from console? Also try to remove .idea folder and all .iml files and import project as new one. – curioushikhov Mar 13 '14 at 09:27
1

I started getting this error because I synced to a previous commit, which had a subproject with

    classpath 'com.android.tools.build:gradle:0.7.+'

in its build.gradle. Changing this to 0.9.+ fixed the error.

Sofi Software LLC
  • 3,879
  • 1
  • 36
  • 34
1

I managed to resolve the same issue by downloading the desired version of gradle from the website: http://www.gradle.org/downloads

Then i extracted the zip file and copied the iib folder into the Android studio gradle lib.

So for example:

Downloads/gradle-1.10/lib/ copy to /Applications/Android Studio.app/plugins/gradle/lib/

Then reload android studio and it should work.

Reedy
  • 1,866
  • 2
  • 20
  • 23
0

I recommend to use Gradle's newest version 1.11. The Android tools team will drop the support for older Gradle versions (that's what I would do).

After you've changed your wrapper from 1.10 to 1.11, you need to check that your wrapper is enabled in the gradle settings.

Don't forget to synchronize your project after that!

enter image description here

vRallev
  • 4,982
  • 3
  • 31
  • 34
  • I've changed to 1.11, "use default gradle wrapper(recommended)" is enabled, but I am still getting this error. :( Btw, I can access to gradle settings from error popup window, how can I open project settings window? I tried everything, but without luck. – Draško Mar 12 '14 at 21:42
  • Sometime between this screenshot and v0.8.10, Google has further dumbed down IntelliJ IDEA and removed all project-level gradle settings. Should make life easier for devs everywhere. – jordanpg Sep 17 '14 at 19:47
0

just delete gradle wrapper file and gradle properties file , and reload your project , auto update will make the rest