'Changing .BuildConfig package
Is there a way to dynamically change the package of the generated file .BuildConfig?
I want to use build.gradle
file to use the applicationId
and change the package name between different builds.
Thanks
Solution 1:[1]
I had also ApplicationId or Package declared in AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="xxx">
Replacing xxx
fixed my problem.
Solution 2:[2]
The applicationId field just changes the packagename in the manifest. All classes will be still in the original package.
Solution 3:[3]
Change code in: Build.gradle (module):
defaultConfig {
applicationId "com.xxxxx.yyyy" <-----!!!
minSdkVersion ?
targetSdkVersion ?
versionCode ?
versionName ?
multiDexEnabled true
}
After sync, APPLICATION_ID from BuildConfig has updated.
If you have problems with installation in emulator. Go to AVD Manager, and make STOP and Cold Boot Now.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jared Burrows |
Solution 2 | rekire |
Solution 3 | Marc PĂ©rez Masdeu |