开发者

Android SQLite database being deleted on "SQLiteDatabase.openDatabase"

开发者 https://www.devze.com 2023-01-08 14:24 出处:网络
I copy over a valid Android SQLite database from the apk to the databases folder on my AVD. I verify with the DDMS FileExplorer that it is there and the size is correct. When I call the following func

I copy over a valid Android SQLite database from the apk to the databases folder on my AVD. I verify with the DDMS FileExplorer that it is there and the size is correct. When I call the following function to open it,

 mDb = SQLiteDatabase.openDatabase(mDatabase_path, null, 
SQLiteDatabase.OPEN_READONLY);

The SQLite DB file is deleted and a SQLiteException, "Unable to open database" is thrown.

What could be deleting it if it exists before the line, then i开发者_如何学Gos gone after?

Ian


My copy function was missing the first byte so corrupting the DB. Android will in that case delete the DB and try to recreate it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号