Circular dependency between the following tasks in gradle

后端 未结 2 1466
北荒
北荒 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'
            }
        }
    }
    
    0 讨论(0)
  • 2021-01-13 01:02

    Disable instant run from settings

    Settings > search for instant run > uncheck "Enable Instant Run to hot swap code/resource changes on display"

    0 讨论(0)
提交回复
热议问题