Skip to content Skip to sidebar Skip to footer

How To Properly Set Multiple Applicationids Or Package Names In My Manifests

I have an issue that is directly related to this question: How to have two build flavors inherit from a root flavor in Android Studio? but it makes sense to pull it out into anothe

Solution 1:

The simplest way to customize the applicationId is to use Gradle's applicationIdSuffix property. Example below:

defaultConfig {
    applicationId 'com.example'
}

flavorGroups 'fruit', 'paid'

productFlavors {
    apple {
        flavorGroup 'fruit'
        applicationIdSuffix '.apple'
    }
    orange {
        flavorGroup 'fruit'
        applicationIdSuffix '.orange'
    }
    free {
        flavorGroup 'paid'
        applicationIdSuffix '.free'
    }
    premium {
        flavorGroup 'paid'
        applicationIdSuffix '.premium'
    }
}

Gradle has a full-featured programming language, Groovy, built in, so you can do more elaborate voodoo than this, but this is the easiest way.

Post a Comment for "How To Properly Set Multiple Applicationids Or Package Names In My Manifests"