bug记录及解决

No cached version

  • 描述 No cached version of com.android.tools.build:aapt2:3.2.1-4818971 available for offline mode.

  • 解决 在Settings > Build, Execution, Deployment > Compiler里找到Command-line Options里将--offline删掉就行了

sqlcipher从3.5.9升级到4.0.1引起的崩溃问题

  • 描述 Caused by: net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;

  • 原因 sqlcipher升级到4.0以后,增加了许多新增功能和加密算法.导致3.0的数据库不能使用了.修复办法如下.

  • https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283

  • 解决

DBHelper 是SQLiteOpenHelper的继承类,构造函数中加入SQLiteDatabaseHook即可
private DBHelper(String name, SQLiteDatabase.CursorFactory factory, int version) {
 super(ApplicationEx.getInstance().getApplicationContext(), name, factory, version,new SQLiteDatabaseHook() {
​
 @Override
 public void preKey(SQLiteDatabase database) {}
​
 @Override
 public void postKey(SQLiteDatabase database) {
 //用来签约3.0的数据库到4.0中
 database.rawQuery("PRAGMA cipher_migrate;", null).close();}
​
 });
 }

你可能感兴趣的:(bug记录及解决)