Sunday, 25 October 2020

Cannot change resolution strategy of dependency configuration, after update to 'com.android.tools.build:gradle:4.1.0'

I've updated com.android.tools.build:gradle to version 4.1.0 and Android Studio to version 4.1 and now I get this error:

Cannot change resolution strategy of dependency configuration ':app:devDebugRuntimeClasspath' after it has been resolved.

If I downgrade gradle to 4.0.2 it runs...
What could it be, libs that didn't update (that would be a breaking change don't see that being the reason, but well...)?

app module:

android {
    ...

    flavorDimensions("app")

    productFlavors {
        create("prod") {
            missingDimensionStrategy("module_network_dim", "urlProd")
        }

        create("qa") {
            applicationIdSuffix = ".qa"
            missingDimensionStrategy("module_network_dim", "urlQa")
        }

        create("dev") {
            applicationIdSuffix = ".dev"          
            missingDimensionStrategy("module_network_dim", "urlDev")
        }
    }
}

dependencies {
    implementation(project(":module-core"))
    implementation(project(":module-network"))
    implementation(project(":module-common"))

    //a lot of individual libs dependencies...
}

network module:

    plugins {
        id("com.android.library")
        kotlin("android")
        kotlin("android.extensions")
        kotlin("kapt")
    }
    
    android {
        compileSdkVersion(AndroidConstants.compileSdkVersion)
        defaultConfig {
            minSdkVersion(AndroidConstants.minSdkVersion)
        }
        androidExtensions {
            isExperimental = true
        }
        compileOptions {
            sourceCompatibility = JavaVersion.VERSION_1_8
            targetCompatibility = JavaVersion.VERSION_1_8
        }
    
        flavorDimensions("module_network_dim")
    
        productFlavors {
            create("urlProd") {
                buildConfigField("String", "IS_URL",  ...)
                buildConfigField("String", "API_URL",  ...)
                buildConfigField("String", "CLIENT_ID", ...)
            }
    
            create("urlQa") {
                buildConfigField("String", "IS_URL",  ...)
                buildConfigField("String", "API_URL",  ...)
                buildConfigField("String", "CLIENT_ID", ...)
            }
    
            create("urlDev") {
                buildConfigField("String", "IS_URL",  ...)
                buildConfigField("String", "API_URL",  ...)
                buildConfigField("String", "CLIENT_ID", ...)
            }
        }
    }

    dependencies {  
        //individual libs dependencies...
    }

core/common module:

plugins {
    id("com.android.library")
    kotlin("android")
    kotlin("android.extensions")
    kotlin("kapt")
}

android {
    compileSdkVersion(AndroidConstants.compileSdkVersion)

    defaultConfig {
        minSdkVersion(AndroidConstants.minSdkVersion)
        android.buildFeatures.dataBinding = true
    }

    androidExtensions {
        isExperimental = true
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    testOptions {
        unitTests.apply {
            isReturnDefaultValues = true
            isIncludeAndroidResources = true
        }
    }
}

dependencies {  
    //individual libs dependencies...
}


from Cannot change resolution strategy of dependency configuration, after update to 'com.android.tools.build:gradle:4.1.0'

No comments:

Post a Comment