Force Android Studio to download and install gradle 1.10 or 1.1

坚强是说给别人听的谎言 提交于 2019-12-18 10:34:33

问题


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!


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.




回答5:


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.




回答6:


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!




回答7:


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



来源:https://stackoverflow.com/questions/22359831/force-android-studio-to-download-and-install-gradle-1-10-or-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!