I am copying a pre-existing database to /data/data/packagename/databases
using code learned from using-your-own-sqlite-database-in-android-applications
it might also just be file permissions - the error message is misleading. first you need to find out the user id of the app (this is assuming you have root access):
$ adb shell grep <packagename> /data/system/packages.xml
output should look like:
<package name="com.fsck.k9" codePath="/data/app/com.fsck.k9-1.apk"
nativeLibraryPath="/data/data/com.fsck.k9/lib"
flags="0" ft="1306ecac340" it="1306ecac9d2" ut="1306ecac9d2"
version="14001" userId="10002">
userId here is 10002.
then fix permissions:
$ adb shell chown -R 10002:10002 /data/data/<packagename>
I am already using as given in that link for a long time..
It works.. Checkout your DB again the table created or not ?
I prefer to install SQLite Manager plugin in firefox for sqlite database operation.. after completing all process as mentioned in the same link..
Checkout http://www.devx.com/wireless/Article/40842/1954.
It contains all database operations.
Use
SQLiteDatabase.openDatabase(dbPath, null,SQLiteDatabase.NO_LOCALIZED_COLLATORS | SQLiteDatabase.CREATE_IF_NECESSARY);
or
SQLiteDatabase.openDatabase(dbPath, null,SQLiteDatabase.OPEN_READWRITE);
When you copy database from your assets directory for example, then you must have android_metadata table created in it already. This table should have two columns:
_id = an integer value
locale = en
Actually, with a bit more reading, I have discovered that I need to
use the SQLiteDatabase.NO_LOCALIZED_COLLATORS
flag when calling
SQLiteDatabase.openDatabase()
- this no longer causes the problem.
It seems that for some reason android requires every database to have a table called android_metadata that includes at least one locale. The reigndesign blog you mentioned tells you how to create the table and prefill it with a locale.
Check if your database contains this table and if the table has some content.