Gradle version 2.2 is required. Current version is xxx 错误解决c

从github上down别人的开源项目下来以后头疼的问题就是如何正确把项目导到本地环境并运行.

本文介绍如何解决标题说明的错误.


转载请标明来源:http://blog.csdn.net/rflyee/article/details/51067793

Android studio编译项目时出现如下错误:

A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /Users/brindy/Projects/TestApp/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip
 
 
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

此时,wrapper中gradle配置的为2.10版本,

这里写图片描述

这是由于android gradle插件之前只支持2.2-2.9版本的,属于gradle的一个bug,详见: 
这里写图片描述

https://android.googlesource.com/platform/tools/base/+/master/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.java#113 
后续版本修复了该问题,但是貌似有时候不起作用: 
https://android.googlesource.com/platform/tools/base/+/b96ce169b385d006cfccc4c9f1e54ab47140f59d

补充: 
gradle3.2.1已修复该bug,详见: 
https://discuss.gradle.org/t/gradle-thinks-2-10-is-less-than-2-2-when-resolving-plugins/13434

gradle3.2.1之前版本解决办法如下:

buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
...
}
 
 
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

转载请标明来源:http://blog.csdn.net/rflyee/article/details/51067793

参考: 
https://discuss.gradle.org/t/gradle-thinks-2-10-is-less-than-2-2-when-resolving-plugins/13434/2


  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This error message means that the Gradle version being used by the project is not compatible with the required version. To fix this issue, you can either update the Gradle version of your project to version 2.2 or downgrade the current Gradle version to version 2.2. To update the Gradle version of your project, you can follow these steps: 1. Open the build.gradle file of your project. 2. Find the line that specifies the Gradle version, it should look like this: `classpath 'com.android.tools.build:gradle:3.0.0'` 3. Replace the Gradle version number with the required version number, which is 2.2: `classpath 'com.android.tools.build:gradle:2.2.0'` 4. Sync your project with the Gradle files to apply the changes. If you want to downgrade the current Gradle version to version 2.2, you can follow these steps: 1. Open the Gradle distribution website at https://services.gradle.org/distributions/ 2. Download the Gradle version 2.2 distribution by clicking on the link that says `gradle-2.2-all.zip` 3. Extract the downloaded file into a new folder on your computer. 4. Open the `gradle/wrapper/gradle-wrapper.properties` file of your project. 5. Change the following line: `distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip` 6. To: `distributionUrl=file:///path/to/gradle-2.2-all.zip` 7. Replace `/path/to/gradle-2.2-all.zip` with the actual path to the extracted Gradle 2.2 distribution on your computer. 8. Sync your project with the Gradle files to apply the changes. After following either of these steps, the project should now be using the required Gradle version and the error message should no longer appear.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值