Answer the question
In order to leave comments, you need to log in
How to properly assemble two apps using productFlavors in android?
Good day to all!
The customer needed to have two applications in google play, which literally differ only in where they make the request, icons and names.
I tried using productFlavors with something like this
flavorDimensions "application"
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "ru.local"
minSdkVersion 19
targetSdkVersion 27
versionCode 30
versionName '1.28'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
signingConfig signingConfigs.config
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
agrodozorSengenta {
applicationIdSuffix ".app1"
dimension "application"
}
agrodozorStandart {
applicationIdSuffix ".app2"
dimension "application"
}
}
Answer the question
In order to leave comments, you need to log in
Specifically in my case, the problem was that I was using a ContentProvider that didn't take care of the unique name.
Once the name was dependent on the version of productFlavors, everything started working.
This is how the modified provider looks like
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="@string/provider_authorities"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_path">
</meta-data>
</provider>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question