我有下面的代码,它给出了运行时错误如下。为什么?外部SQLite文件内容访问错误
try{
String myPath = DB_PATH + DB_NAME;
mDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
}catch(SQLiteException e){}
运行时错误:
:sqlite returned: error code = 1, msg = no such table: android_metadata
:SELECT locale FROM android_metadata failed
:Failed to setLocale() when constructing, closing the database
:android.database.sqlite.SQLiteException: no such table: android_metadata
一个解决方案可以是,使用openOrCreateDatabase而不是openDatabase。这将创建数据库,如果它不可用。 – Mudassir 2011-03-04 07:23:35