在我的应用程序中,我有一个SyncAdapter
使用 aContentProvider
将数据放入 SQLiteDatabase。几个月来一切都运行良好。在我添加了从 GCM 推送通知更新 ContentProvider 的第二种方法后,我开始收到一些用户的崩溃报告,例如
android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 3850)
或者
android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 778)
以及与 sqlite 相关的其他几个例外。
虽然我听说 Sqlite 是同步的,我们不必担心,但我确实收到了这些错误,表明我需要以某种方式同步。有没有人处理过这个问题?
编辑:这是一个示例堆栈跟踪
android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 778)
1
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
2
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:906)
3
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
4
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
5
at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469)
6
at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1365)
7
at com.makanstudios.conscious.provider.ConsciousProvider.doInsert(ConsciousProvider.java:225)
8
at com.kaciula.utils.provider.BasicContentProvider.insert(BasicContentProvider.java:80)
9
at android.content.ContentProvider$Transport.insert(ContentProvider.java:201)
10
at android.content.ContentResolver.insert(ContentResolver.java:866)
11
at com.makanstudios.conscious.net.DatabaseHandler.updateStatsCount(DatabaseHandler.java:351)
12
at com.makanstudios.conscious.net.DatabaseHandler.updateStatsCount(DatabaseHandler.java:362)
13
at com.makanstudios.conscious.gcm.GCMIntentService.onMessage(GCMIntentService.java:124)
14
at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:223)
15
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
16
at android.os.Handler.dispatchMessage(Handler.java:99)
17
at android.os.Looper.loop(Looper.java:137)
18
at android.os.HandlerThread.run(HandlerThread.java:60)
还有另一个示例堆栈跟踪:
0
android.database.sqlite.SQLiteException: not an error (code 0): Could not open the database in read/write mode.
1
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
2
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:318)
3
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:229)
4
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:515)
5
at android.database.sqlite.SQLiteConnectionPool.reconfigure(SQLiteConnectionPool.java:339)
6
at android.database.sqlite.SQLiteDatabase.reopenReadWrite(SQLiteDatabase.java:832)
7
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:213)
8
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
9
at com.kaciula.utils.provider.BasicContentProvider.insert(BasicContentProvider.java:76)
10
at android.content.ContentProvider$Transport.insert(ContentProvider.java:201)
11
at android.content.ContentResolver.insert(ContentResolver.java:869)
12
at com.makanstudios.conscious.net.DatabaseHandler.updateStatsCount(DatabaseHandler.java:351)
13
at com.makanstudios.conscious.net.DatabaseHandler.updateStatsCount(DatabaseHandler.java:362)
14
at com.makanstudios.conscious.gcm.GCMIntentService.onMessage(GCMIntentService.java:124)
15
at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:223)
16
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
17
at android.os.Handler.dispatchMessage(Handler.java:99)
18
at android.os.Looper.loop(Looper.java:137)
19
at android.os.HandlerThread.run(HandlerThread.java:60)