Guys,
I'm still pulling my hair out trying to figure out what is up with
this issue. Many of my users report the following exception when I try
to upgrade my onboard database - a database that I create offline and
ship int he assets of my app:
android.database.sqlite.SQLiteException: Can't downgrade database from
version 62 to 1
at
android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:
299)
at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:
160)
at x.DataBaseHelper.createDataBase(DataBaseHelper.java:75)
at x.MyApp$11.run(MyApp.java:675)
at java.lang.Thread.run(Thread.java:1020)
This only happens on certain phone versions, my guess being 2.3 and up
and it doesn't happen with the emulator.
My code looks like this:
public void createDataBase() throws IOException{
boolean dbExist = checkDataBase();
if(dbExist){
//do nothing - database already exists
}else{
// delete the old database
//By calling this method an empty database will be created into
the default system path
//of your application so we can overwrite that database
with our database.
try{
specialWierdDatabaseUpgradeFailure = false;
this.getWritableDatabase();
}
catch(Exception e){
specialWierdDatabaseUpgradeFailure = true;
}
try {
copyDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
}
}
}
I cannot figure out why it thinks I'm "downgrading" to version 1.
Has anyone run into this problem?
Thanks,
pawpaw17
--------------------------------------------------------------------------------
--
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