Can we release 2 flavours of app with same package name but different minSdk in playstore?

53 Views Asked by At

Below is my code of app GRADLE file where I am overriding my default configurations by setting the flavor.

My app is already in play store, I have to integrate Health Connect library of google. As per this library requirement minimum SDK should be 26 and I want app should be available for both 26 above and 26 below android users.

Questions:

  1. Will I be able to upload app to play store with same package name and different minimum SDK?

  2. I have to keep Client1 and Client2 as two flavor with two builds. One with minimum SDK21 and other with minimum SDK 26.

  3. I also need to manage version code for all flavor differently to release to play store.

     android {
     compileSdk 34
     defaultConfig {
         applicationId "com.mobile.android"
         minSdk 21
         targetSdk 33
         versionCode 22
         versionName "2.2.2"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         vectorDrawables.useSupportLibrary = true
    
         renderscriptTargetApi 22
         renderscriptSupportModeEnabled true
     }
    
     buildTypes {
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
         debug{
             minifyEnabled false
         }
     }
    
     flavorDimensions "api","version"
     productFlavors {
         client1 {
             dimension "version"
             applicationId "com.client.one"
             targetSdk 33
             versionCode 22
             versionName "2.2.2"
             resValue "string", "app_name", "ClientOne"
             manifestPlaceholders = [
                     appIcon: "@mipmap/ic_launcher",
                     appIconRound: "@mipmap/ic_launcher_round"
             ]
         }
         client2 {
             dimension "version"
             applicationId "com.client.two"
             targetSdk 33
             versionCode 1
             versionName "1.0"
             resValue "string", "app_name", "ClientTwo"
             manifestPlaceholders = [
                     appIcon: "@mipmap/ic_launcher",
                     appIconRound: "@mipmap/ic_launcher_round"
             ]
         }
     minApi26 {
       dimension "api"
       minSdk 26
     }
     minApi21 {
       dimension "api"
       minSdk 21
     }
     }
    
     productFlavors.all {
         flavor ->
             println( flavor.name)
             defaultConfig.buildConfigField 'String', 'var_'+flavor.name, '\"'+flavor.name+'\"'
     }
    
     buildFeatures {
         viewBinding true
         dataBinding true
     }
    
     packagingOptions {
         exclude 'META-INF/rxjava.properties'
     }
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
     kotlinOptions {
         jvmTarget = '1.8'
     }
    }
    
1

There are 1 best solutions below

0
Goutham On

You have to choose any one of the choices. You can't provide multiple minSdks with the same package to the users. If Health Connect is important for the application, then go with minSdk 26 otherwise minSdk 21.