Reputation: 34
Is there any way to change applicationId without changing packagename in android studio?
As read some where i changed applicationid from flavors in project module setting. but doing this getting
Error:Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.myapplicationid'
Is there any idea how to do this?
and my gradle is after changing flavor
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId 'com.myapplicationid'
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
productFlavors {
}
}
dependencies {
....
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 0
Views: 4022
Reputation: 11
2 steps to answer your question:
If you got an error No matching client found for package name... when doing so, then just try steps as follows and it worked for me:
Upvotes: 1
Reputation: 3305
You can set applicationId from defaultConfig and remove productFlavors from build.gradle file (I've tested, it should work):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.myapplicationid"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
....
}
apply plugin: 'com.google.gms.google-services'
If you look carefully, I removed
productFlavors {
}
part
Also, don't forget to update the google-services.json
Upvotes: 1
Reputation: 5311
You can declare different applicationId like this
android {
flavorDimensions "Flavors1"
productFlavors {
Flavors1{
applicationId "com.myapplicationid1"
}
Flavors2{
applicationId "com.myapplicationid2"
}
}
}
If you want to change the applicationId just update in defaultConfig
defaultConfig {
applicationId "your_new.id"
}
Don't forgot to update the google-services.json
if you have used
Upvotes: 1
Reputation: 305
You can declare multiple Flavors for your application like this
productFlavors {
MainApp {
applicationId = "com.company.app"
}
NewAppFlavor {
applicationId = "com.company.newapp"
}
}
and build your application and sign using this flavor and you can change between different flavors via build variants option in android studio
Upvotes: 1