sqlite setlocale错误

时间:2011-10-13 13:35:30

标签: android sqlite

我有一个db in assets文件夹,它被复制到app。它的完成方式与此处完全相同:http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

在android 2.3.3及更高版本中一切正常但在下面的版本中不起作用。这些是我测试应用程序的手机:

三星Galaxy S II - ANDROID 2.3.3 - 正常工作

Sony Ericsson neo - ANDROID 2.3.3 - 正在运作

LG P350 - ANDROID 2.2.2 - 错误复制db

Sony Ericsson Xperia X8 - ANDROID 2.1-update 1 - 错误复制db

三星GalaxyACE Android 2.2.1。 - 错误复制db

三星Galaxy Tab 10.1 Android 3.1 - 正常工作

错误如下所示:

10-13 13:03:43.773: ERROR/Database(2770): SELECT locale FROM android_metadata failed
10-13 13:03:43.783: ERROR/Database(2770): Failed to setLocale() when constructing, closing the database
10-13 13:03:43.783: ERROR/Database(2770): android.database.sqlite.SQLiteException: no such table: android_metadata
10-13 13:03:43.783: ERROR/Database(2770):     at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
10-13 13:03:43.783: ERROR/Database(2770):     at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1950)
10-13 13:03:43.783: ERROR/Database(2770):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1818)
10-13 13:03:43.783: ERROR/Database(2770):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:817)
10-13 13:03:43.783: ERROR/Database(2770):     at org.com.db.DataBaseHelper.checkDataBase(DataBaseHelper.java:81)
10-13 13:03:43.783: ERROR/Database(2770):     at org.com.db.DataBaseHelper.createDataBase(DataBaseHelper.java:42)
10-13 13:03:43.783: ERROR/Database(2770):     at org.com.SentencesActivity.onCreate(SentencesActivity.java:49)
10-13 13:03:43.783: ERROR/Database(2770):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-13 13:03:43.783: ERROR/Database(2770):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-13 13:03:43.783: ERROR/Database(2770):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-13 13:03:43.783: ERROR/Database(2770):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-13 13:03:43.783: ERROR/Database(2770):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-13 13:03:43.783: ERROR/Database(2770):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-13 13:03:43.783: ERROR/Database(2770):     at android.os.Looper.loop(Looper.java:123)
10-13 13:03:43.783: ERROR/Database(2770):     at android.app.ActivityThread.main(ActivityThread.java:4627)
10-13 13:03:43.783: ERROR/Database(2770):     at java.lang.reflect.Method.invokeNative(Native Method)
10-13 13:03:43.783: ERROR/Database(2770):     at java.lang.reflect.Method.invoke(Method.java:521)
10-13 13:03:43.783: ERROR/Database(2770):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-13 13:03:43.783: ERROR/Database(2770):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-13 13:03:43.783: ERROR/Database(2770):     at dalvik.system.NativeStart.main(Native Method)
10-13 13:03:43.793: VERBOSE/Debugger(2770): Copying db
10-13 13:03:43.893: WARN/dalvikvm(2770): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

1 个答案:

答案 0 :(得分:1)

问题不适用于旧版本的Android,因为数据库太大而且限制为18mb。解决此问题的方法是将db ino 18文件拆分为1 mb。