我正在尝试将sqlcipher从1.1版更新到2.2.2。新版本的sqlcipher在全新安装或从eclipse运行时都能正常工作。但是当我更新之前使用v1.1 sqlcipher和新v2.2.2的应用程序时,库无法正确加载。当我调用SQLiteDatabase.loadLibs(this)时,应用程序崩溃了。我在logcat中获得以下信息
09-11 11:21:56.887:I / Database(26277):JNI_OnLoad叫
09-11 11:21:56.887:I / Database(26277):JNI_OnLoad注册方法
09-11 11:21:56.887:E / Database(26277):找不到SQLiteDatabase.mNativeHandle
09-11 11:21:56.887:E / Cursor(26277):找不到net / sqlcipher / database / SQLiteCompiledSql
09-11 11:21:56.887:E / Cursor(26277):找不到net / sqlcipher / database / SQLiteQuery
09-11 11:21:56.887:E / Cursor(26277):找不到net / sqlcipher / database / SQLiteProgram
09-11 11:21:56.887:E / Cursor(26277):找不到net / sqlcipher / database / SQLiteStatement
09-11 11:21:56.887:E / CursorWindow(26277):找不到net / sqlcipher / CursorWindow
09-11 11:21:56.903:W / dalvikvm(26277):threadid = 11:线程退出未捕获异常(组= 0x40b73930)
更新:我正在使用proguard。当我关闭proguard时,SQLiteDatabase.loadLibs(this)运行正常。但这次我无法打开加密数据库。我正在传递相同的正确密码以打开数据库。
09-11 14:21:48.950:I / Database(31543):sqlite返回:错误代码= 26,msg =文件已加密或不是数据库
09-11 14:21:48.950:E / Database(31543):CREATE TABLE android_metadata失败
09-11 14:21:48.965:E / Database(31543):构建,关闭数据库时无法setLocale()
09-11 14:21:48.965:E / Database(31543):net.sqlcipher.database.SQLiteException:文件已加密或不是数据库
09-11 14:21:48.965:E / Database(31543):at net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)
09-11 14:21:48.965:E / Database(31543):at net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2102)
09-11 14:21:48.965:E / Database(31543):at net.sqlcipher.database.SQLiteDatabase。(SQLiteDatabase.java:1968)
09-11 14:21:48.965:E / Database(31543):at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:901)
09-11 14:21:48.965:E / Database(31543):at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:944)
09-11 14:21:48.965:E / Database(31543):at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:107)
09-11 14:21:48.965:E / Database(31543):at alc.rhapsody.mdd.database.DatabaseAdapter.openDatabase(DatabaseAdapter.java:234)
09-11 14:21:48.965:E / Database(31543):at alc.rhapsody.mdd.presenter.SplashViewPresenter.getAdmissionAccess(SplashViewPresenter.java:152)
09-11 14:21:48.965:E / Database(31543):at alc.rhapsody.mdd.presenter.SplashViewPresenter.access $ 2(SplashViewPresenter.java:99)
09-11 14:21:48.965:E / Database(31543):at alc.rhapsody.mdd.presenter.SplashViewPresenter $ AdmissionCtrl.doInBackground(SplashViewPresenter.java:235)
09-11 14:21:48.965:E / Database(31543):at alc.rhapsody.mdd.presenter.SplashViewPresenter $ AdmissionCtrl.doInBackground(SplashViewPresenter.java:1)
09-11 14:21:48.965:E / Database(31543):在android.os.AsyncTask $ 2.call(AsyncTask.java:287)
09-11 14:21:48.965:E / Database(31543):at java.util.concurrent.FutureTask.run(FutureTask.java:234)
09-11 14:21:48.965:E / Database(31543):at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
09-11 14:21:48.965:E / Database(31543):at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:573)
09-11 14:21:48.965:E / Database(31543):at java.lang.Thread.run(Thread.java:856)
答案 0 :(得分:0)
你是否提供了该文件的密码,好像你没有,一旦你提供了数据库,也要在标志中使用NO_LOCALIZED_COLLATORS