从gradle 0.8更新到0.9

时间:2014-03-07 09:47:41

标签: android gradle android-gradle

我已经从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.

1 个答案:

答案 0 :(得分:1)

好的,我修好了。对于正在阅读的人,问题出在您的

的gradle /包装/ 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

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