Android Studio Gradle 问题升级到 0.5.0 版 - Gradle 从 0.8 迁移到 0.9 - Android Studio 也升级到 0.8.1
升级后消息状态:
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 to
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(使用Fix it"链接几次:S),并修改"android" 项目文件夹中 gradle 文件的部分,从 19.0 到 19.1,如下所示:构建脚本{存储库{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'
}