Hi,
Every once in a while, I'm getting the exception below ever since I
started using SQLite for persistence.
It usually happens when I install a new version of my app, and it
happens both on the emulator, and on the actual phone.
I'm not changing the structure of the database during these redeploys.
I also didn't see any database related exceptions prior to this error.
11-27 23:47:58.108: ERROR/Database(252): CREATE TABLE android_metadata
failed
11-27 23:47:58.128: ERROR/Database(252): Failed to setLocale() when
constructing, closing the database
11-27 23:47:58.128: ERROR/Database(252):
android.database.sqlite.SQLiteException: unsupported file format
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:
1750)
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:
1700)
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:
738)
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:
760)
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:
753)
11-27 23:47:58.128: ERROR/Database(252): at
android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:
473)
11-27 23:47:58.128: ERROR/Database(252): at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:
193)
11-27 23:47:58.128: ERROR/Database(252): at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:
193)
11-27 23:47:58.128: ERROR/Database(252): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:
98)
I'm using the following code to initialize the database
private DatabaseHelper DBHelper;
private SQLiteDatabase db;
public DBAdapter(Context ctx) {
this.context = ctx;
DBHelper = new DatabaseHelper(context);
}
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
db.execSQL(DATABASE_DROP);
onCreate(db);
}
}
public DBAdapter open() throws SQLException {
db = DBHelper.getWritableDatabase();
return this;
}
public void close() {
DBHelper.close();
}
I always open/close the database and cursors properly on each database
operation.
The only remedy so far is to remove the application completely, and re-
install if from scratch.
However, this is not really an option. Has anyone else experienced
this and is there a remedy for it ?
Regards,
Davy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en