Gradle - add applicationIdSuffix depending on buildType for a specific productFlavor

515 views Asked by At

In an Android (Java/Gradle/Android Studio) application, I am trying to achieve setting an applicationIdSuffix (".dev") for my debug builds, but ONLY for a specific product flavor (let's say flavorA). For example what I want is:

flavorA release id -> com.company.flavorA
flavorA debug id -> com.company.flavorA.dev
flavorB release id -> com.company.flavorB
flavorB debug id -> com.company.flavorB

I do know how to set the .dev suffix in all flavors in the buildTypes debug block, and I have set some buildConfigField values that depend on both flavors and buildTypes via an applicationVariants.all { variant -> () } loop. I have not yet managed to use this loop for setting an applicationIdSuffix.

I have also tried adding productFlavors.flavorA.applicationIdSuffix ".dev" in the debug buildType block, but for some reason it is also applied to the release build - which I find quite strange.

Lastly,

flavorA {
   applicationIdSuffix = [debug: ".dev"]
}

also doesn't seem to work.

Is there any way I can get the behavior I want?

0

There are 0 answers