I have multiple flavours in my app lets call them Flavour_1 & Flavour_2. Each flavour has an unique keystore Flavour_1_Release_Key & Flavour_2_Release_Key.
I generate an apk using Flavour_1 and version '1.0.1' and then install that to my device.
I then generate an apk using Flavour_2 and call this version '1.0.2' I can then go to my device and install Flavour_2 over the top of Flavour_1 even though they are built with different keys.
I was under the impression you could only install an incremented version using the same keystore.
I've provided my build.gradle for reference
apply plugin: 'com.android.application'
android {
signingConfigs {
flavour1Release {
keyAlias 'Flavour_1_alias'
keyPassword 'password'
storeFile file('C:/PATH/TO/KEY/Flavour_1_Keystore.jks')
storePassword 'password'
}
flavour2Release {
keyAlias 'Flavour_2_alias'
keyPassword 'password'
storeFile file('C:/PATH/TO/KEY/Flavour_2_Keystore.jks')
storePassword 'password'
}
}
compileSdkVersion 27
defaultConfig {
applicationId "com.my.app"
vectorDrawables.useSupportLibrary = true
minSdkVersion 22
targetSdkVersion 22
versionCode 101
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
flavorDimensions "customer"
productFlavors {
// productFlavour attributes override those in defaultConfig
Flavour_1 {
dimension "customer"
signingConfig signingConfigs.flavour1Release
}
Flavour_2 {
dimension "customer"
signingConfig signingConfigs.flavour2Release
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar', '*.arr'], dir: 'libs')
}
Side note I am testing this by building a Flavour_1.apk and Flavour_2.apk dropping them onto an emulator and installing there Flavour_1.apk first then Flavour_2.apk without any issue.