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 {
...
}
}
gradle (Module: app) in Gradle Scripts. Here change the applicationId and click on Sync Now. And you are successfully renamed your package name.
Right-click on the package name you want to change and use the Refactor > Rename… option again. Select Rename all when prompted by Android Studio.
NOTE: By default, the Android Studio will generate "debug" and "release" Build Types for your project. So, to change a Build Type, all you need to do is just select your Build Type from the Build Variant and after the project sync, you are good to go.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With