Android Studio Gradle 问题升级到版本 0.5.0 - Gradle 从

Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1(Android Studio Gradle 问题升级到版本 0.5.0 - Gradle 从 0.8 迁移到 0.9 - Android Studio 也升级到 0.8.1)
本文介绍了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

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)