Android Studio - Failed to notify project evaluati

2019-02-01 16:15发布

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

25条回答
老娘就宠你
2楼-- · 2019-02-01 16:31

The only thing that helped me was to use the system gradle instead of Android Studio's built-in:

SETTINGS -> Build, Execution, Deployment -> Gradle

Select Use local gradle distribution. To find the path, you can do which gradle where the which program is supported. It might be /usr/bin/gradle.

See also Error:Could not initialize class com.android.sdklib.repositoryv2.AndroidSdkHandler for another possible cause.

查看更多
手持菜刀,她持情操
3楼-- · 2019-02-01 16:32

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.

查看更多
淡お忘
4楼-- · 2019-02-01 16:32

I enabled "Offline-Work" under File -> Settings ->Build,Deploy, Exec -> Gradle And this finally resolved the issue for me.

查看更多
Emotional °昔
5楼-- · 2019-02-01 16:34

In my case, i got wifi problem. make sure you have valid internet connection

查看更多
乱世女痞
6楼-- · 2019-02-01 16:36

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

查看更多
我命由我不由天
7楼-- · 2019-02-01 16:36

In my case I had to update all the Firebase libraries to the latest versions.

查看更多
登录 后发表回答