我在我的 android 应用程序数据库中收到此错误。
在SQLite
数据库中,我assets
借助此代码从文件夹中的脚本获取数据库查询。
manager = context.getResources().getAssets();
input = manager.open("createDb.xml");
xpp.setInput(input, null);
int type = xpp.getEventType();
while(type != XmlPullParser.END_DOCUMENT) {
if(type == XmlPullParser.START_DOCUMENT) {
Log.d(Tag, "In start document");
}
else if(type == XmlPullParser.START_TAG) {
Log.d(Tag, "In start tag = "+xpp.getName());
}
else if(type == XmlPullParser.END_TAG) {
Log.d(Tag, "In end tag = "+xpp.getName());
}
else if(type == XmlPullParser.TEXT) {
Log.d(Tag, "Have text = "+xpp.getText());
String strquery = xpp.getText();
db.execSQL(strquery);
}
type = xpp.next();
}
}
catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
并且工作正常。
但我在SQLCipher
数据库中运行相同的代码,它总是给出这个错误和应用程序崩溃。
即使我已经添加了所有必要的库。
Failure 0 (not an error) on 0x1a1ab0 when executing '
FATAL EXCEPTION: main
net.sqlcipher.database.SQLiteException: not an error:
at net.sqlcipher.database.SQLiteDatabase.native_execSQL(Native Method)
at net.sqlcipher.database.SQLiteDatabase.execSQL(SQLiteDatabase.java:1834)
at com.acs.android.fwk.database.ScriptExecutor.executeScripts(ScriptExecutor.java:86)
at com.acs.android.fwk.database.DatabaseHelper.onCreate(DatabaseHelper.java:55)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:121)
at com.acs.android.fwk.database.DatabaseAdapter.open(DatabaseAdapter.java:79)
at com.acs.android.fwk.database.DatabaseAdapter.<init>(DatabaseAdapter.java:49)
at com.acs.android.fwk.database.DatabaseAdapter.getInstance(DatabaseAdapter.java:37)
at com.acs.nomad.ui.controller.DbDemoController.saveData(DbDemoController.java:27)
at com.acs.nomad.ui.controller.DbDemoController_$1.onClick(DbDemoController_.java:39)
at android.view.View.performClick(View.java:3511)
at android.view.View$PerformClick.run(View.java:14105)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
请提供任何帮助。
坦斯克