Runtime SQLite Table crash after upgrading Core and Messaging Versions

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.6.3
  • Firebase Component: Core & Messaging
  • Component version: Core 17.4.1 & Messaging 20.1.7

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

We recently updated our Firebase Messaging version from 19.0.1 to 20.1.7 and Firebase Core from 17.0.0 to 17.4.1 .

After doing so, when we relaunched our app, a crash surfaced related to the package:

Here is the stack trace:

Process:, PID: 11938
    android.database.sqlite.SQLiteException: table event_payloads already exists (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE event_payloads (sequence_num INTEGER NOT NULL, event_id INTEGER NOT NULL, bytes BLOB NOT NULL,FOREIGN KEY (event_id) REFERENCES events(_id) ON DELETE CASCADE,PRIMARY KEY (sequence_num, event_id))
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(
        at android.database.sqlite.SQLiteConnection.prepare(
        at android.database.sqlite.SQLiteSession.prepare(
        at android.database.sqlite.SQLiteProgram.<init>(
        at android.database.sqlite.SQLiteStatement.<init>(
        at android.database.sqlite.SQLiteDatabase.executeSql(
        at android.database.sqlite.SQLiteDatabase.execSQL(
        at$$Lambda$4.upgrade(Unknown Source:0)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(
        at$$Lambda$1.produce(Unknown Source:2)
        at$$Lambda$ Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

I could reproduce it by having a version of the app, which had the old firebase version installed, and then upgrading the apk to the app with the updated firebase versions.

It’s unclear if this crash and upgrade of Firebase Versions are related.

1 possible answer(s) on “Runtime SQLite Table crash after upgrading Core and Messaging Versions

  1. seeing this as well. app is crashing in a loop. only workaround is uninstall or clearing data.

    We’re using both firebase-messaging:20.1.6 and firebase-crashlytics:17.0.0, so I’m not sure which one is the culprit as both seem to link against ‘transport-runtime’.
    We’re using android gradle plugin version 3.5.3.