For use product flavors for this.
Each product flavor can have different applicationId
:
android {
…
productFlavors {
prod {
applicationId "com.example.myapp"
}
stage {
applicationId "com.example.myapp.stage"
}
}
}
Or you can add applicationIdSuffix
to a flavor:
android {
…
defaultConfig {
applicationId "com.example.myapp"
}
productFlavors {
prod {
}
stage {
applicationIdSuffix ".stage"
}
}
}
It's also useful if you want to be able to install both release and debug:
android {
buildTypes {
debug {
applicationIdSuffix ".debug"
}
}
}
If you use it in both product flavor and build type, it will be chained, product flavor goes before build type. In this example suffix for fullDebug
variant would be ".stage.debug"
.