androidfirebase-app-distribution

App not installed due to conflict when app from play store is also installed


I'm running into an odd issue and not at all sure why.

I'm using firebase app distribution to install development-grade versions of my app and whenever I try to install a dev version of my app, it won't install claiming that the app exists already, but it doesn't.

I have the app from the store installed and upon uninstalling that, the app will then install but I don't understand why as both have different applicationIds.

the store version has: com.example.myapp & the dev version has com.example.myapp.preview and the app name is also different as is the version code and version name.

I don't get what they seem to share that is causing it to not allow both of them to coexist.

Not sure if this is important, but when I try to install the dev version, play protect will pop-up claiming the app is unknown and to be sure you trust it.

I'm hoping someone can steer me in a direction on solving this as I'm simply lost on what's causing the conflict.

here is the relevant gradle config:

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.myppp"
        targetSdkVersion 32
        minSdkVersion 26

        versionCode verCode
        versionName "4.2.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        development {
            storeFile file("../keystore/development.jks")
            storePassword System.getenv("DEV_SIGNING_STORE_PASSWORD")
            keyAlias System.getenv("DEV_SIGNING_KEY_ALIAS")
            keyPassword System.getenv("DEV_SIGNING_KEY_PASSWORD")
        }
        debug {
            storeFile file("../keystore/debug.jks")
            storePassword System.getenv("DEBUG_SIGNING_STORE_PASSWORD")
            keyAlias System.getenv("DEBUG_SIGNING_KEY_ALIAS")
            keyPassword System.getenv("DEBUG_SIGNING_KEY_PASSWORD")
        }
        release {
            storeFile file("../keystore/prod.jks")
            storePassword System.getenv("PROD_SIGNING_STORE_PASSWORD")
            keyAlias System.getenv("PROD_SIGNING_KEY_ALIAS")
            keyPassword System.getenv("PROD_SIGNING_KEY_PASSWORD")
        }
    }

    buildTypes {
        development {
            versionNameSuffix "-DEV"
            minifyEnabled false
            applicationIdSuffix '.preview'
            debuggable true
            signingConfig signingConfigs.development

            firebaseCrashlytics {
                mappingFileUploadEnabled false
            }
        }
        debug {
            versionNameSuffix "-DEBUG"
            minifyEnabled false
            applicationIdSuffix '.debug'
            signingConfig signingConfigs.debug

            firebaseCrashlytics {
                mappingFileUploadEnabled false
            }
        }
        release {
            signingConfig signingConfigs.release

            // Enables code shrinking, obfuscation, and optimization for only your project's release build type.
            minifyEnabled true

            // Enables resource shrinking, which is performed by the Android Gradle plugin.
            shrinkResources true

            // Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            // Makes crash reports readable
            // @see https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android
            firebaseCrashlytics {
                mappingFileUploadEnabled true
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    packagingOptions {
        resources {
            excludes += ['META-INF/*.kotlin_module']
        }
    }
    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
    }
    buildFeatures {
        viewBinding true
    }
    lint {
        abortOnError true
    }
}

Solution

  • I have discovered my issue, it appears I was reusing the same file provider identifier, I made that more dependent on the application id and now I'm able to install the dev app alongside my store version.

    I also has add product flavors as I saw a few SO answers claim that's a better way to go about what I was looking to do.