user2589370
user2589370

Reputation:

Android Studio 1.0 Gradle Error with getConfiguration()

I changed everything else as needed in my gradle files, but I'm hitting one error I can't seem to resolve:

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.

If it's of any help, here's my main build.gradle file:

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

Upvotes: 5

Views: 9495

Answers (5)

AlexGuti
AlexGuti

Reputation: 3243

Cleaning project or gradle did not work for me. I had to change gradle distribution from 2.2.1 to 2.4.

In gradle-wrapper.properties file:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

Upvotes: 12

Leonardo Cardoso
Leonardo Cardoso

Reputation: 1164

If those previous answers don't work and you are upgrading your Android Studio, try to update the gradle/wrapper folder by creating a new project and copying this folder from the new project and overwriting to your old one. It worked for me.

Upvotes: 0

Kio Krofovitch
Kio Krofovitch

Reputation: 3022

I was able to resolve this error by upgrading to the lastest release of my android maven plugin:

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

Upvotes: 20

ibit
ibit

Reputation: 316

I also had this issue. This was resolved once I removed apply plugin: 'android-maven' from one of my build files.

Upvotes: 7

Igor Romcy
Igor Romcy

Reputation: 366

The newest android studio requires gradle version 2.2+ , are you using this version ? If yes, try invalidate cache / restart on File menu.

Upvotes: 0

Related Questions