Android Studio - Failed to notify project evaluation listener error

Following is the build.gradle code in Android Studio

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.sg.blahblah"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    lintOptions {
        checkReleaseBuilds true
        abortOnError false
        xmlReport true
        htmlReport true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            lintOptions {
                disable 'MissingTranslation'
            }
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.google.android.apps.dashclock:dashclock-api:+'
    compile 'com.roughike:bottom-bar:1.4.0.1'
    compile 'com.diogobernardino:williamchart:2.2'
}

I am getting the below error: Error:A problem occurred configuring project ':app'.

Failed to notify project evaluation listener. com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V

Can anyone please help?

Following is the Instant Run screenshot enter image description here


Solution 1:

I got this problem too. I fix it by Change build.gradle in project

Change

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
}

And also I change the distributionUrl in gradle-wrapper.properties(Global Version)

distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip

And got succeed.FYI.

Solution 2:

I am facing same error before a week I solve by disabling the Instant Run

File → Settings → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run.

Hope it works.

Note This answer works on below Android Studio 3

Solution 3:

you need check your gradle version. gradle -v

then you should know your gradle version and your gradle plugin version compatible.

Example:

gradle 4.6 is not compatible with gradle plugin 2.2.

so need update com.android.tools.build:gradle version to 2.3.3.

then you need check gradle/wrapper/gradle-wrapper.properties distributionUrl gradle version

google Android Plugin for Gradle Release Notes

enter image description here

on the other hand

using newer plugin version might require to update Android Studio

thanks @antek

Solution 4:

I also encountered this error when updating to 'com.android.tools.build:gradle:3.0.0'

To fix it, I had to add the google() repo to both the buildscript and module repositories. The documentation here only mentions adding to to the buildscript.

Project-level build.gradle

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

App-level build.gradle

repositories {
    ...
    // Documentation doesn't specify this, but it must be added here
    google()
}

gradle-wrapper.properties

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