您的位置:首页 > 产品设计 > UI/UE

Gradle version 2.2 is required. Current version is 2.10

2016-05-04 13:54 483 查看
down
v
Gradle
version 2.2 is required. Current version is 2.10
原文链接:http://stackoverflow.com/questions/34749299/gradle-version-2-2-is-required-current-version-is-2-10

Question:

down
votefavorite

I am trying to use gradle build. It gives me error saying that

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

But my gradle-wrapper.properties includes gradle-2.4-all.zip. I have changed it to gradle-2.2-all.zip Still same problem.

When I run gradle -version in terminal Gradle 2.10 shows as version.

How to solve that error??

my build gradle file is
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}

allprojects {
repositories {
jcenter()
}
}


Answer:

up votedown
voteaccepted
Open
gradle-wrapper.properties


Change this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip


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


Go to
build.gradle
(Project:
your_app_name)

Change this line
classpath 'com.android.tools.build:gradle:XXX'


to this
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'


or
classpath 'com.android.tools.build:gradle:1.5.0'


Don't click
Sync
Now

From menu choose
File
-> Invalidate Caches/Restart...

Choose first option:
Invalidate
and Restart


Android Studio would restart. After this, it should work normally

Hope it help

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: