Reputation: 3972
In a Android gradle build, I can simply let the build "overwrite" the package name by flavor like so:
productFlavors {
free {
applicationId "net.company.appname.free"
}
paid {
applicationId "net.company.appname.paid"
}
}
Can I do the same by build type?
It looks like I can only add suffixes:
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
...
}
}
Upvotes: 11
Views: 4293
Reputation: 1636
A bit late on with the answer, but you could have a common part of the applicationID defined such as:
android {
defaultConfig {
applicationId 'net.company.appname'
...
}
}
and have your flavours specify the applicationIdSuffix as in your example, so that'd give you the 'net.company.appname.debug' and 'net.company.appname.release' or whatever you say you want the suffix to be.
Upvotes: 5
Reputation: 789
It actually does, if you build the .apk the package will be
for free flavor and debug build type (with your buildType config): net.company.appname.free.debug
for the paid : net.company.appname.paid.debug
it adds the suffix to the package name. That is why release does not use to have sufix so it has the package "raw". That also allows you to have multiple build types from every flavor on the same device installed at the same time
Upvotes: 0