android-library with specific Product Flavors dependency

前端 未结 1 1193
野性不改
野性不改 2021-01-12 05:53

I\'m looking for something like

apply plugin: \'android-library\'

dependencies {
    flavor1Compile files(\'utility.aar\')
}

Everything fa

1条回答
  •  借酒劲吻你
    2021-01-12 06:24

    Libraries don't support flavors.

    Note that this wouldn't work in a app project because you haven't defined the flavor first. You'd need to do

    android {
        productFlavors {
            flavor1 {}
        }
    }
    
    dependencies {
        flavor1Compile ...
    }
    

    it wouldn't work in the other order as declaring the product flavor is what create its associated dependency configuration.

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