Android Studio Gradle version - Gradle version 2.8 is required

≯℡__Kan透↙ 提交于 2019-12-05 05:38:18

问题


I'm trying to build an Android project but the following error occurred

Error:(10, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in C:\Users\...\gradle\wrapper\gradle-wrapper.properties to gradle-2.8-all.zip

It seem something's wrong with the Gradle version, however I checked the gradle-wrapper-property and it's already 2.10.

Also in File-Project Structure-Project, gradle-version is also 2.10

No idea how this happened, I've also restarted android-studio many times.


回答1:


For those that still need help, an answer on another post did it for me link.

You need to change Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path

Or set Use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties files field distributionUrl like this

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



回答2:


I don't think that changing Gradle tools to version 1.5.0 is necessary, but if you're using 2.0-snapshot or beta version of gradle, I recommend you to change it to 1.5.0.

This error:

Error:(10, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in

C:\Users...\gradle\wrapper\gradle-wrapper.properties to gradle-2.8-all.zip

only tells you that your project's Gradle system is a bit outdated and need to be updated to newer version.

Open your project Android Studio and in navigator on the left find file called gradle-wrapper.properties. It should have a content like this:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

Change the last line with distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

It should work.




回答3:


Go To Android Preference and Just change Project level Settings to Use default gradle wrapper (recommended).




回答4:


There is a bug in version checking in older android plugins. To fix this you can either go back to gradle 2.9 or use the newer plugin

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}

But I see from your error message that it tries to run with gradle 2.4 so this is maybe another problem.




回答5:


Updating the version of android studio from 1.4 to 1.5.1 fixed this problem for me.



来源:https://stackoverflow.com/questions/34605667/android-studio-gradle-version-gradle-version-2-8-is-required

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