Firebase distribution erase the data on update

33 Views Asked by At

Suddenly when I send new Android APKs to my testers, it says "Replace app" instead of "Upgrade app", and this causes the data of the app to be erased before the update, without a chance to run migrations, backups, or other procedures (the data is an SQLite database).

This means the user data gets lost.

The user try to update from 1.2.738 (738) -> 1.2.744 (744).

What I need to change to avoid this problem?

My fastlane setup is:

default_platform(:android)

platform :android do
  desc "Submit a new Beta Build to Firebase Beta"
  lane :beta do
    gradle(task: 'clean')

    gradle(task: "assemble", build_type: "Release")

    changelog_from_git_commits

    firebase_app_distribution(
      app: "1:95127...",
      groups: "testers",
      firebase_cli_token: "1//05Vrgw...."
    )
  end
end

I take the build number from git in gradle:

def versionMajor = 1
def versionMinor = 2

def gitVersion() {
    def process = "git rev-list master --first-parent --count".execute()
    return process.text.toInteger()
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com...."
        minSdk 26
        targetSdk 33
        versionCode gitVersion()
        versionName "${versionMajor}.${versionMinor}.${gitVersion()}"
        vectorDrawables.useSupportLibrary = true
    }
}
0

There are 0 best solutions below