问题描述
升级后消息状态:
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 后出现同样的问题
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
".
转到您的 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"部分,如下所示:构建脚本 {存储库{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'
}
这篇关于Android Studio Gradle 问题升级到版本 0.5.0 - Gradle 从 0.8 迁移到 0.9 - Android Studio 也升级到 0.8.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!