I only want to change application id in gradle file, but dont want to change package name.
Is it possible?

- 8,084
- 8
- 48
- 62

- 157
- 2
- 9
3 Answers
It is not recommended to change your application id. What you can do is change your application suffix.
As an example, if your application id is com.example.my_app then add different suffixes for different build types, such as com.example.myapp.dev for debug.
Go to app/build.gradle file and on android block add the suffix you want:
buildTypes {
release {
applicationIdSuffix ".production"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".dev"
versionNameSuffix '-DEBUG'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Read more about it here

- 2,785
- 2
- 13
- 17
No problem. You can change your application Id as long as your app is not on store. If you change your application id, It would immediately become a different app for google play.
I have many apps with different package name and application ids.

- 650
- 1
- 7
- 16
-
2i have two app and they copy of each other. when i only change application ids and try to download from store, i getting this error "INSTALL FAILED CONFLICTING PROVIDER" but now i solve it. also need to add android:authorities="${applicationId}" its solve my problem.. – Bahadır Civelek Sep 07 '17 at 06:24
-
Great! Glad you figured it out:) – Orcun Sep 07 '17 at 13:54
Yes you can change androidId
in defaultConfig
.
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.somepkg" // <- we can change applicationId in defaultConfig
minSdkVersion 21
targetSdkVersion 26
vectorDrawables.useSupportLibrary = true
....
}
}
Also we can change applicationId
in flavors use suffix or override it:
flavorDimensions "app"
productFlavors {
qa {
dimension "app"
applicationIdSuffix = ".qa" // <- add suffix (it will be )
}
production {
applicationId = "com.someotherpkg" // <- we can change applicationId in flavors
dimension "app"
}
}
However your src files will be still in the same folders.

- 1,391
- 18
- 18