How can I change the applicationId
field of my build.gradle
file?
defaultConfig {
applicationId "com.oldname.appname"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
I've already renamed the package structure to com.newname.appname
and all the imports and things like that have updated, but applicationId
hasn't. I can't refactor it and just trying to type in a new name brings up a ton of errors where Android Studio will tell me my main FragmantActivity
"is not applicable to android.app.Activity" and so on.
Any idea what to do? Thanks in advance.
You can create different flavours for one application in Gradle file. This will increase the code reusability.
An example for an application with Paid and Free flavors:
productFlavors {
paid {
applicationId "com.oldname.appname.paid"
}
free {
applicationId "com.oldname.appname.free"
}
}
So these two flavours will act as two products. You can upload it to play store as different applications.
You can also get four build variant for this two flavours.
com.oldname.appname.free- debug
com.oldname.appname.free- release
com.oldname.appname.paid- debug
com.oldname.appname.paid- release
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