問題描述
升級后消息狀態(tài):
Failed to refresh Gradle project 'XXX'
The project is using an unsupported version of the Android Gradle plug-in (0.8.3).
Version 0.9.0 introduced incompatible changes in the build language.
Please read the migration guide to learn how to update your project.
將 Android Studio 升級到版本 >= 0.8.0 后出現(xiàn)同樣的問題
Same kind of issue after upgrade to Android Studio to version >= 0.8.0
推薦答案
要修復它,請在項目根目錄中打開名為 build.gradle
的文件,并將那里的 gradle 版本更改為 0.9.+.
To fix it, open file called build.gradle
in the project root, and change gradle version there to 0.9.+.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
為每個項目重復;(
如果您隨后收到類似無法加載類 'org.gradle.api.artifacts.result.ResolvedComponentResult
"的消息.
If you then get a message like "Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult
".
轉(zhuǎn)到您的 project_folder/gradle/wrapper
目錄并編輯 Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult'.
文件更改 distributionUrl
到
Go to you project_folder/gradle/wrapper
directory and edit Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult'.
file changing the distributionUrl
to
distributionUrl=http://services.gradle.org/distributions/gradle-1.10-all.zip
升級到 0.8.1 版后(完整下載并復制 SDK 文件夾),必須通過 IDE 安裝新版本的 gradle(使用修復它"鏈接幾次:S),并修改從 19.0 到 19.1 的項目文件夾中的 gradle 文件的android"部分,如下所示:構(gòu)建腳本 {存儲庫{mavenCentral()}依賴{類路徑'com.android.tools.build:gradle:0.12.+'}}應用插件:'android'
After upgrade to version 0.8.1 (full download and copy SDK folder over), had to have new version of gradle installed by IDE (using the "Fix it" link a couple of time :S ), and modifing the "android" section of the gradle file in project folder from 19.0 to 19.1, as below: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' } } apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:support-v4:19.1.0'
}
這篇關(guān)于Android Studio Gradle 問題升級到版本 0.5.0 - Gradle 從 0.8 遷移到 0.9 - Android Studio 也升級到 0.8.1的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!