android - 从 gradle 0.8 更新到 0.9

标签 android gradle android-gradle-plugin

我已经从 Gradle 0.8 更新到 0.9,但它给我带来了不兼容的问题。我已尝试修复它,但我不知道问题出在哪里。

非常感谢您的帮助。这是我的 Gradle 文件 :) 谢谢!

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'
    compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'
    compile 'commons-lang:commons-lang:2.6'
    compile 'com.nhaarman.listviewanimations:library:2.5.2'
    compile files('libs/TestFlightLib.jar')
    compile 'com.android.support:support-v4:19.0.1'
}

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

编辑:

错误是这样的:

 Failed to refresh Gradle project 'gradle'
 Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult'.
 This is an unexpected error. Please file a bug containing the idea.log file.

最佳答案

好的,我修好了。看书的人,问题出在你身上

gradle/wrapper/gradle-wrapper.properties

文件。该文件应与此类似:

#Fri Mar 07 11:15:20 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

特别是,您需要 gradle-1.10 而不是 gradle-1.9

如果您没有此文件(我就是这种情况),只需创建它并重建项目即可。如果仍然存在错误,请清理项目并重新构建。

关于android - 从 gradle 0.8 更新到 0.9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22246646/

相关文章:

android - 从android模拟器调试https

jar - gradle替换类文件修改 list

android - 自动在 gradle 上添加模块依赖

android - 使用 setBinding 在 Android 项目的 settings.gradle 上导入库的问题

android - 适用于 Android 的终端 IDE 应用程序是否与 Lollipop 兼容?

android - 我想在 android 中的背景图像中添加透明叠加层

java - Kotlin 胶囊 Gradle 错误

android - 不同机器之间的 lint 差异

android - java.util.zip.ZipException : duplicate entry: android/support/v7/appcompat/R$anim. 类

java - 为什么使用全局异常处理时必须使用try catch?