Reputation: 756
So I have this app1 and I want to create a app2, from the app1, It will be almost the same app, but with differences in the layout. I manage to do that using productFlavors. The result need to be two apps in the Play store, both free and the user can have both in his phone.
However I can build both apk for debug, but when I install one, the phone doesn't let me install the other. Will this happen after both are uploaded to the store?
This is my gradle:
defaultConfig {
applicationId "com.example.app"
minSdkVersion 16
targetSdkVersion 25
versionCode 48
versionName "3.1.1"
multiDexEnabled true
}
signingConfigs {
String releaseFilename = "/.androidReleaseKeys/example_release.properties"
Properties props = new Properties()
props.load(new FileInputStream(file(releaseFilename)))
release {
storeFile file(props.getProperty('keystore'))
storePassword props.getProperty('keystore.password')
keyAlias props.getProperty('keyAlias')
keyPassword props.getProperty('keyAlias.password')
}
}
productFlavors{
app1{
applicationId "com.example.app"
buildTypes {
debug {
buildConfigField "String", "GOOGLEMAPS_API_KEY", "\"${googleMapsAPIDev}\"";
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
signingConfig signingConfigs.release
buildConfigField "String", "GOOGLEMAPS_API_KEY", "\"${googleMapsAPIRelease}\"";
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
app2{
applicationId "com.example2.app2"
versionCode 1
versionName "1"
multiDexEnabled true
buildTypes {
debug {
buildConfigField "String", "GOOGLEMAPS_API_KEY", "\"${googleMapsAPIDev}\"";
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
signingConfig signingConfigs.release
buildConfigField "String", "GOOGLEMAPS_API_KEY", "\"${googleMapsAPIRelease}\"";
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Upvotes: 2
Views: 425
Reputation: 1185
Declare this permission in manifest with ${applicationId}
placeholder:
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
Do not hardcode package name in manifest.
Upvotes: 1