我正在尝试使用 gradle build.它给了我错误,说
I am trying to use gradle build. It gives me error saying that
无法应用插件 [id 'com.android.library']需要 Gradle 版本 2.2.当前版本是 2.10.如果使用 gradle 包装器,请尝试将/home/sanjeewa/workspace/Android/UVCCamera/gradle/wrapper/gradle-wrapper.properties 中的 distributionUrl 编辑为 gradle-2.2-all.zip
Failed to apply plugin [id 'com.android.library'] Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /home/sanjeewa/workspace/Android/UVCCamera/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip
但我的 gradle-wrapper.properties 包含 gradle-2.4-all.zip.我已将其更改为 gradle-2.2-all.zip还是同样的问题.
But my gradle-wrapper.properties includes gradle-2.4-all.zip. I have changed it to gradle-2.2-all.zip Still same problem.
当我在终端中运行 gradle -version 时,Gradle 2.10 显示为版本.
When I run gradle -version in terminal Gradle 2.10 shows as version.
如何解决这个错误??
我的构建 gradle 文件是
my build gradle file is
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
gradle-wrapper.properties
改变这一行:
gradle-wrapper.properties
Change this line:
distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip
与
distributionUrl=https://services.gradle.org/distributions/gradle-2.8-all.zip
build.gradle
(项目:your_app_name)改变这一行
build.gradle
(Project: your_app_name)Change this line
classpath 'com.android.tools.build:gradle:XXX'
到这里
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
或
classpath 'com.android.tools.build:gradle:1.5.0'
立即同步
File ->使缓存无效/重新启动...
无效并重新启动
Android Studio 将重新启动.之后,它应该可以正常工作了
Android Studio would restart. After this, it should work normally
希望对你有帮助
这篇关于需要 Gradle 版本 2.2.当前版本是 2.10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!