且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从的gradle 0.8至0.9更新

更新时间:2023-02-07 14:23:53

好吧,我固定它。对于那些谁正在阅读,问题是位于

gradle这个/包装/ gradle-wrapper.properties

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

  #Fri三月07 11点15分二十○秒CET 2014年
distributionBase = GRADLE_USER_HOME
distributionPath =包装/ dists中
zipStoreBase = GRADLE_USER_HOME
zipStorePath =包装/ dists中
distributionUrl = HTTP \\://services.gradle.org/distributions/gradle-1.10-all.zip

在特定的,你需要gradle这个-1.10,而不是gradle这个-1.9

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

I've updated from Gradle 0.8 to 0.9 but it gives me incompatibility problems. I've tried to fix it but I don't know exactly where the problem is.

A help is really appreciated.. this is my Gradle file :) thanks!

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'
    }
}

EDIT:

The error is something like:

 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.

Ok, I fixed it. For those who are reading, the problem is located in your

gradle/wrapper/gradle-wrapper.properties

file. The file should be similar to this:

#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

In particular, you need gradle-1.10 and not gradle-1.9

If you don't have this file (that was my case), just create it and rebuild the project. If there are still errors, clean the project and build it again.