Circular dependency between the following tasks in gradle

后端 未结 2 1482
北荒
北荒 2021-01-13 00:43

I\'m running my project in AndroidStudio 3.2, but there is an error

FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between          


        
2条回答
  •  日久生厌
    2021-01-13 00:54

    As noted by @hocine-b in the comments, this may happen if you enable shrinkResources in ProGuard.

    It only occurs when Instant Run is enabled, i.e. in debug builds when you press the "Run" button.

    You can fix it by only shrinking resources in release builds, for example, in your module's build.gradle:

    android {
        buildTypes {
            debug {
                minifyEnabled true
                shrinkResources false  // Avoid conflicts with Instant Run 
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
    
            release {
                minifyEnabled true
                shrinkResources true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    

提交回复
热议问题