【Bug修复】数据库异常SQLiteFullException: database or disk is full 问题解决修复(低版本手机)
【Bug修复】数据库异常SQLiteFullException: database or disk is full 问题解决修复(目前在6.0及以下低版本手机出现)**日志堆栈信息**:Caused by: net.sqlcipher.database.SQLiteFullException: database or disk is full: COMMIT;
·
【Bug修复】数据库异常SQLiteFullException: database or disk is full(目前在Android 6.0及以下低版本手机出现)
问题说明
【Bug修复】数据库异常SQLiteFullException: database or disk is full(目前在6.0及以下低版本手机出现)
日志堆栈信息:
1. Caused by: net.sqlcipher.database.SQLiteFullException: database or disk is full: COMMIT;
2. at net.sqlcipher.database.SQLiteDatabase.native_execSQL(Native Method)
3. at net.sqlcipher.database.SQLiteDatabase.execSQL(SourceFile:4)
4. at net.sqlcipher.database.SQLiteDatabase.endTransaction(SourceFile:19)
5. at com.commonsware.cwac.saferoom.b.endTransaction(SourceFile:1)
6. at androidx.room.RoomDatabase.endTransaction(SourceFile:1)
7. at com.model.class.b.r.insert(SourceFile:5)
8. at com.model.class.b.p$a.a(SourceFile:1)
9. at com.model.class.b.p$a.call(SourceFile:1)
10. at io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(SourceFile:4)
11. at j.a.o.subscribe(SourceFile:14)
12. at io.reactivex.internal.operators.observable.ObservableSubscribeOn$b.run(SourceFile:1)
13. at j.a.w$a.run(SourceFile:2)
14. at j.a.h0.g.m.run(SourceFile:2)
15. at j.a.h0.g.m.call(SourceFile:1)
16. at java.util.concurrent.FutureTask.run(FutureTask.java:237)
17. at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
18. at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
19. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
20. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
分析解决
【根本原因】数据库或磁盘已满。数据库插入操作没有处理异常,导致报错
【解决方案】对数据库插入操作进行异常处理
【代码定位】可从log7、8、9中 model.class 定位报错相关类,或从听云中【异常溯源中定位】具体类
相关代码
在插入代码块中增加代码:
.doOnError(e -> Log.e("DeviceExpandDao", "insert: ", e))
添加后完整代码:
public void insert(List<DevExpandInfoBean> infoBeans) {
if (ValidUtils.isListEmpty(infoBeans)) {
return;
}
Observable
.fromCallable(() -> {
DatabaseManager.getInstance().getAppDatabase()
.deviceExpandDao().insert(new CopyOnWriteArrayList<>(infoBeans));
return true;
})
.doOnError(e -> Log.e("DeviceExpandDao", "insert: ", e))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe();
}
写在最后
此文章为个人修复bug时记录,有时时间有限,无法深入研究,若看到此文章后有其他见解或解决方式,欢迎留言交流👇👇👇
————————————————
版权声明:转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44158429/article/details/122410112
更多推荐
已为社区贡献1条内容
所有评论(0)