无法更改依赖配置的解析策略,更新到 'com.android.tools.build:gradle:4.1.0' 后
Cannot change resolution strategy of dependency configuration, after update to 'com.android.tools.build:gradle:4.1.0'
我已将 com.android.tools.build:gradle
更新到 4.1.0 版,并将 Android Studio 更新到 4.1 版,现在我收到此错误:
Cannot change resolution strategy of dependency configuration
':app:devDebugRuntimeClasspath' after it has been resolved.
如果我将 gradle 降级到 4.0.2,它会运行...
可能是什么,没有更新的库(这将是一个重大的变化,不认为这是原因,但是......)?
应用程序 模块:
plugins {
id("com.android.application")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
}
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...
}
网络模块:
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...
}
核心/普通模块:
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...
}
com.android.tools.build:gradle:4.1.1
似乎解决了“问题”
我已将 com.android.tools.build:gradle
更新到 4.1.0 版,并将 Android Studio 更新到 4.1 版,现在我收到此错误:
Cannot change resolution strategy of dependency configuration ':app:devDebugRuntimeClasspath' after it has been resolved.
如果我将 gradle 降级到 4.0.2,它会运行...
可能是什么,没有更新的库(这将是一个重大的变化,不认为这是原因,但是......)?
应用程序 模块:
plugins {
id("com.android.application")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
}
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...
}
网络模块:
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...
}
核心/普通模块:
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...
}
com.android.tools.build:gradle:4.1.1
似乎解决了“问题”