I’m trying to implement dependencies only for a specific build variant.
I have 4 flavors split in 2 dimensions as follows:
flavorDimensions += listOf(
ProjectAndroidConstants.APP_TYPE_DIMENSION,
ProjectAndroidConstants.OPERATING_SYSTEM_DIMENSION
)
productFlavors {
// 'operatingSystem' dimension
create(ProjectAndroidConstants.ANDROID_FLAVOR) {
isDefault = true
dimension = ProjectAndroidConstants.OPERATING_SYSTEM_DIMENSION
}
create(ProjectAndroidConstants.HUAWEI_FLAVOR) {
dimension = ProjectAndroidConstants.OPERATING_SYSTEM_DIMENSION
}
// 'appType' dimension
create(ProjectAndroidConstants.TOTO_FLAVOR) {
isDefault = true
dimension = ProjectAndroidConstants.APP_TYPE_DIMENSION
}
create(ProjectAndroidConstants.TATA_FLAVOR) {
dimension = ProjectAndroidConstants.APP_TYPE_DIMENSION
}
}
The problem is a single flavor implementation works but not a combinaison:
// This works
"${ProjectAndroidConstants.TOTO_FLAVOR}Implementation("com.myproject.android:authentication-session:0.1.0")
// This doesn't work and I get error: Configuration with name 'totoAndroidImplementation' not found
"${ProjectAndroidConstants.TOTO_FLAVOR}${ProjectAndroidConstants.ANDROID_FLAVOR}Implementation"("com.myproject.android:authentication-session:0.1.0")
On this page there is an example of Implementation but with only one dimension and when there is multiple dimensions there is no Implementation example.
I precise that work with Kotlin DSL