我使用sqlcipher编码我的数据库。我已经添加了库和jar文件,它在api 18和16上运行正常但它在api 11上给了我这个错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{}: net.sqlcipher.database.SQLiteException: not an error
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: net.sqlcipher.database.SQLiteException: not an error
at net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1942)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:875)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:868)
at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:903)
at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:914)
at com.example.com.DBAdapter.open(DBAdapter.java:106)
at com.example.com.Spots.onCreate(Spots.java:81)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
... 11 more
这是我从SD卡打开数据库的方式:
SQLiteDatabase.loadLibs(context);
String outFileName = Environment.getExternalStorageDirectory() +"/Android/data/"+ context.getPackageName()
+ "/files/files.dll";
File databaseFile = new File(outFileName);
db = SQLiteDatabase.openOrCreateDatabase(databaseFile,"mypass", null);
这是我的资产文件夹和lib文件夹的图像:
你能帮我解决这个问题吗?
谢谢