SQLite Room问题汇总

问题1:

Caused by: net.sqlcipher.database.SQLiteException: error code 14: Could not open database

原因:程序A访问程序B(待集成程序)数据库出现权限问题

解决:程序A集成程序B访问代码

问题2:

java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.

原因:无法访问主线程上的数据库,因为它可能会长时间锁定 UI。

解决:使用线程池开启线程

问题3:

NoClassDefFoundError: Failed resolution of: Landroidx/databinding/DataBinderMapperImpl;

原因:

解决:

问题4:

  • Duplicate class org.apache.commons.io.ByteOrderMark found in modules jetified-commons-io-2.5 (commons-io-2.5.jar) and jetified-xxx-1.0.-SNAPSHOT-runtime (com.xxx.xxx:xxx:1.0.-SNAPSHOT:xxx.092926-89)
  • 原因:包依赖冲突
  • 解决:
    // commons-io
implementation files('libs/commons-io-2.5.jar')
implementation files('libs/commons-io-2.5-javadoc.jar')
// BasicThreadFactory
implementation 'org.apache.commons:commons-lang3:3.9'

改为:

implementation group: 'commons-io', name: 'commons-io', version: '2.6'
// BasicThreadFactory
implementation 'org.apache.commons:commons-lang3:3.9'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值