SQLite 语句中止,数据库锁定在 Android 应用程序中

Bar*_*ans 5 sqlite android ormlite

在我的应用程序中,我使用 ORMLite 在我的 SQLite 数据库中插入数据。在某些设备上,插入数据时出现以下错误:

02-05 09:29:56.864  22365-22441/com.app E/SQLiteLog? (5) statement aborts at 2: [PRAGMA journal_mode=PERSIST]
02-05 09:29:56.864  22365-22441/com.app W/SQLiteConnection? Could not change the database journal mode of '/data/data/com.app/databases/app.db' from 'wal' to 'PERSIST' because the database is locked.  This usually means that there are other open connections to the database which prevents the database from enabling or disabling write-ahead logging mode.  Proceeding without changing the journal mode.
Run Code Online (Sandbox Code Playgroud)

我不知道如何为 ORMLite 解决这个问题。有没有人解决我的问题?仅访问一个 SQLOpenHelper 并不能解决我的问题,因为我使用的是 ORMLite 并且不直接从我的代码中使用 SQLOpenHelper。

Ste*_*hot 0

您是否在该语句之前使用查询,似乎该威胁的执行仍在执行?

也许您需要等待结果才能开始另一个查询?不确定是否是这种情况,试着和你一起思考。