我在 Android 專案中有以下口味配置:
android {
buildTypes {
release { }
debug { }
}
flavorDimensions "fruit", "color"
productFlavors {
apple {
dimension "fruit"
}
peach {
dimension "fruit"
}
banana {
dimension "fruit"
}
red {
dimension "color"
}
green {
dimension "color"
}
yellow {
dimension "color"
}
}
}
dependencies {
appleRedImplementation 'com.apple:color_red:1.1.0'
appleGreenImplementation 'com.apple:color_green:1.1.0'
appleYellowImplementation 'com.apple:color_yellow:1.1.0'
// No dependency for other fruit build type
}
我需要保持com.apple:color_*:1.1.0相關性只為appleflavorDimensions建立,但改變它基礎上,colorflavorDimensions建立?
uj5u.com熱心網友回復:
如果要向多個構建風味維度的特定配置添加依賴項,則需要先定義這些組合:
android{
...
productFlavors {
...
}
configurations {
appleRedImplementation {}
appleGreenImplementation {}
appleYellowImplementation {}
}
}
這個答案在這里也參考了這個:https : //stackoverflow.com/a/60776044/2258611
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/358322.html
上一篇:任務“:app:validateSigningDebug”執行失敗。java.util.concurrent.ExecutionException:
