Skip to content Skip to sidebar Skip to footer

Overwrite Application Id Outside Of Flavors And Build Types

I have an application with many flavors (A,B,C) and two build types (debug,release) In the build type debug I add a suffix to the application ID like so: debug { applicationId

Solution 1:

Is it possible to override a variants application ID depending on the flavor

Yes it is possible.

The reason you are not able to see the expected id is:

Because Gradle applies the build type configuration after the product flavor, the application ID for the "C" build variant will be "<your-applicaion-id>.debug".

So if you want it to be different for different flavors then you have to segregate the applicationIdSuffix for different flaovors and remove it from debug {} as follows:

android {
    defaultConfig {
        applicationId "<your-application-id>"
    }
    productFlavors {
        A {
            applicationIdSuffix ".debug"
        }
        B {
            applicationIdSuffix ".debug"
        }
        C {
            applicationIdSuffix ""
        }
    }
}

For more details, refer to official documentation.

Post a Comment for "Overwrite Application Id Outside Of Flavors And Build Types"