getConfiguration()的Android Studio 1.0 Gradle错误

5 android gradle android-studio android-gradle-plugin

我在gradle文件中根据需要更改了其他所有内容,但是我遇到了一个我似乎无法解决的错误:

Error:Unable to find method 'org.gradle.api.internal.project.ProjectInternal.getConfigurations()Lorg/gradle/api/internal/artifacts/configurations/ConfigurationContainerInternal;'.

Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Run Code Online (Sandbox Code Playgroud)

如果有任何帮助,这是我的主build.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 9
        versionName "1.6"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/gson-2.2.4.jar')
    compile project('libs:anddown')
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile files('libs/android-support-v7-recyclerview.jar')
}
Run Code Online (Sandbox Code Playgroud)

Kio*_*tch 20

我能够通过升级到我的android maven插件的最新版本来解决此错误:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        ...
        classpath 'com.github.dcendents:android-maven-plugin:1.2'
    }
}
Run Code Online (Sandbox Code Playgroud)


Ale*_*uti 12

清洁项目或gradle对我不起作用.我不得不将gradle分布从2.2.1更改为2.4.

gradle-wrapper.properties档案中:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
Run Code Online (Sandbox Code Playgroud)


小智 7

我也有这个问题.一旦我apply plugin: 'android-maven'从我的一个构建文件中删除,就解决了这个问题.

  • 当你删除这个插件给出的可能性时,这不是正确的答案.而是像Kio建议的那样将版本升级到1.2. (3认同)