我在firebase crashlytics中得到了这个崩溃报告,标题为-SQLiteConnection.java android.数据库.sqlite.SQLiteConnection.nativeExecute
并且堆栈跟踪列出这些错误:
Fatal Exception: java.lang.IllegalStateException
The file system on the device is in a bad state. WorkManager cannot access the app's internal data store.
androidx.work.impl.utils.ForceStopRunnable.run (ForceStopRunnable.java:128)
androidx.work.impl.utils.SerialExecutor$Task.run (SerialExecutor.java:91)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)
堆栈中的上一个项目
Caused by android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5)
at android.database.sqlite.SQLiteConnection.nativeExecute(SQLiteConnection.java)
at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:569)
at android.database.sqlite.SQLiteSession.beginTransactionUnchecked(SQLiteSession.java:323)
at android.database.sqlite.SQLiteSession.beginTransaction(SQLiteSession.java:298)
at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:539)
at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:450)
at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.beginTransaction(FrameworkSQLiteDatabase.java:69)
at androidx.work.impl.WorkDatabase$2.onOpen(WorkDatabase.java:163)
at androidx.work.impl.WorkDatabase_Impl$1.onOpen(WorkDatabase_Impl.java:113)
at androidx.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:136)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.java:195)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:349)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:238)
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.inTransaction(RoomDatabase.java:622)
at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.java:399)
at androidx.work.impl.model.SystemIdInfoDao_Impl.getWorkSpecIds(SystemIdInfoDao_Impl.java:120)
at androidx.work.impl.background.systemjob.SystemJobScheduler.reconcileJobs(SystemJobScheduler.java:298)
at androidx.work.impl.utils.ForceStopRunnable.cleanUp(ForceStopRunnable.java:249)
at androidx.work.impl.utils.ForceStopRunnable.forceStopRunnable(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:110)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
因此,SQLiteDatabaseLockedException发生在SystemIdInfoDao_Impl.getWorkSpecIds(SystemIdInfoDao_Impl.java:120)行,当使用工作管理器内部表SystemIdInfo和ForceStopRunnable.forceStopRunnable(ForceStopRunnable.java:215)行时,ForceStopRunnable的forceStopRunnable方法正在调用该异常。
我想了解更多关于何时调用这些函数的信息。描述**“应用程序被强制停止后,WorkManager将重新启动。应用程序被强制停止时,警报和作业将被取消。为了重新调度,我们创建了一个挂起的警报,该警报将不会在强制停止后继续存在。"**我不清楚。
有人能帮我理解这些并帮我修复崩溃吗?
1条答案
按热度按时间bf1o4zei1#
问题是你没有关闭之前的操作,并试图在数据库中执行另一个操作。在执行一些操作后,你必须关闭SQLiteDatabase。通过使用以下代码
然后开始下一个CRUD操作