复制列名称run_in_foreground的原因是什么原因编译Alter Table Workspec添加列run_in_foreground Integer而不是null默认值0
不知道为什么我的设备在后台运行的某些用户会遇到此崩溃,该错误可能是由于 workmanager 库而导致的,所以我无法修复该问题,任何人都可以在这里帮助找出根本原因。
我们正在使用这个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)
在应用程序类中编写了这段代码
override fun getWorkManagerConfiguration() =
Configuration.Builder()
.setMinimumLoggingLevel(android.util.Log.INFO)
.build()
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论