转载请标明来源: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
此时,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'
...
}
转载请标明来源: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