android / codelab-android-workmanager

Apache License 2.0
551 stars 239 forks source link

Fatal Exception: android.database.sqlite.SQLiteException duplicate column name: run_in_foreground (code 1 SQLITE_ERROR): , while compiling: ALTER TABLE workspec ADD COLUMN `run_in_foreground` INTEGER NOT NULL DEFAULT 0 #292

Open amit016verma opened 2 years ago

amit016verma commented 2 years ago

Hi Team,

We are getting very heavy crash of WorkManager library whenever database migration happening which code written by workmanager it self

So we found that clevertap also using work manager library which is androidx.work:work-runtime:2.3.4

And We are using which is api "androidx.work:work-runtime-ktx:2.2.0" Clevertap lib using in our project is

api 'com.clevertap.android:push-templates:0.0.8'
api 'com.clevertap.android:clevertap-android-sdk:4.0.0'
implementation 'com.clevertap.android:clevertap-xiaomi-sdk:1.0.0'

Have written this piece of code in application class

override fun getWorkManagerConfiguration() =
        Configuration.Builder()
            .setMinimumLoggingLevel(android.util.Log.INFO)
            .build()
android.database.sqlite.SQLiteConnection.nativePrepareStatement (SQLiteConnection.java)
android.database.sqlite.SQLiteConnection.acquirePreparedStatement (SQLiteConnection.java:1055)
android.database.sqlite.SQLiteConnection.prepare (SQLiteConnection.java:662)
android.database.sqlite.SQLiteSession.prepare (SQLiteSession.java:590)
android.database.sqlite.SQLiteProgram.<init> (SQLiteProgram.java:61)
android.database.sqlite.SQLiteStatement.<init> (SQLiteStatement.java:33)
android.database.sqlite.SQLiteDatabase.executeSql (SQLiteDatabase.java:1930)
android.database.sqlite.SQLiteDatabase.execSQL (SQLiteDatabase.java:1852)
androidx.sqlite.db.framework.FrameworkSQLiteDatabase.execSQL (FrameworkSQLiteDatabase.java:242)
androidx.work.impl.WorkDatabaseMigrations$6.migrate (WorkDatabaseMigrations.java:209)
androidx.room.RoomOpenHelper.onUpgrade (RoomOpenHelper.java:99)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onUpgrade (FrameworkSQLiteOpenHelper.java:177)
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked (SQLiteOpenHelper.java:421)
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase (SQLiteOpenHelper.java:321)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase (FrameworkSQLiteOpenHelper.java:145)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase (FrameworkSQLiteOpenHelper.java:106)
androidx.room.RoomDatabase.beginTransaction (RoomDatabase.java:352)
androidx.work.impl.utils.ForceStopRunnable.cleanUp (ForceStopRunnable.java:156)
androidx.work.impl.utils.ForceStopRunnable.run (ForceStopRunnable.java:87)
androidx.work.impl.utils.SerialExecutor$Task.run (SerialExecutor.java:91)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
java.lang.Thread.run (Thread.java:923)

please help to find out the root cause so we can solve as soon as possible

This crash happening only when user is in background , but wont able to replicate on our device, So do not have any idea how to solve this

amit016verma commented 2 years ago

can anyone help here please its quite urgent