Android Studio - Failed to notify project evaluation listener error

前端 未结 30 1870
悲&欢浪女
悲&欢浪女 2020-12-13 11:45

Following is the build.gradle code in Android Studio

apply plugin: \'com.android.application\'

android {
    compileSdkVersion 23
    buildToolsVersion \"23         


        
30条回答
  •  隐瞒了意图╮
    2020-12-13 12:19

    Usually it depends on Instant run or Gradle, but I tried both variants and nothing helped me. Then I looked through idea.log and saw this error

    Caused by: java.lang.RuntimeException: A conflict was found between the 
    following modules:
     - com.android.support:support-core-utils:25.3.1
     - com.android.support:support-core-utils:27.0.1
    

    I really don't know why this error is not shown in Gradle Console or Event Log tab. Then I fixed it by adding some code to the end of android{} block.

    configurations.all {
        resolutionStrategy {
            failOnVersionConflict()
            eachDependency { DependencyResolveDetails details ->
                if (details.requested.name == 'support-core-utils') {
                    details.useVersion '25.3.1'//Or you can use 27.0.1 if it does not conflict with your other dependencies
                }
        }
    }
    

提交回复
热议问题