我有带有“水”和“蓝色”口味的自定义库:
flavorDimensions "water", "blue"
productFlavors
{
water
{
flavorDimensions "water"
}
blue
{
flavorDimensions "blue"
}
}
configurations
{
waterDebugCompile
waterReleaseCompile
blueDebugCompile
blueReleaseCompile
}
两者都从“主”文件夹覆盖 TestA.class
TestA.class from "main" has a method that toast "MAIN"
TestA.class from "water" => "WATER"
TestA.class from "blue" => "BLUE"
在应用程序中我有:
dependencies {
implementation project(':mylibrary')
}
flavorDimensions "water", "blue"
productFlavors {
water {
flavorDimensions "water"
applicationId "com.test.water"
matchingFallbacks = ['water']
}
blue {
flavorDimensions "blue"
applicationId "com.test.blue"
matchingFallbacks = ['blue']
}
}
但是当我为可能的应用程序选择“blueDebug”变体时,它会像我预期的那样烤“MAIN”而不是“BLUE”
为什么 ?
谢谢