Whats cause of duplicate column name run_in_foreground while compiling ALTER TABLE workspec ADD COLUMN run_in_foreground INTEGER NOT NULL DEFAULT 0

Viewed 173

do not have idea why I am getting this crash for some user whose device is in background, that error might be coming because of the workmanager library so I am not able fix that ,Can anyone help here to find out the root cause.

we are using this library of workmanager

api "androidx.work:work-runtime-ktx:2.2.0"

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

Have written this piece of code in application class

 override fun getWorkManagerConfiguration() =
        Configuration.Builder()
            .setMinimumLoggingLevel(android.util.Log.INFO)
            .build()
0 Answers
Related