About OTA upgrade exception analysis due to database not degraded after upgrading from high to low version

Source: Internet
Author: User
Tags sqlite

1. Description of the problem:
OTA upgrade from a high version to a lower version of the success, after the desktop alarm icon is missing, and the desktop alarm clock error, unable to open the app.
The
reference log is as follows:
01-14 20:29:22.290:e/androidruntime (2722): FATAL exception:asynchandler
01-14 20:29:22.290:e/androidruntime (2722): Process:com.android.deskclock, pid:2722
01-14 20:29:22.290:e/androidruntime (2722): Android.database.sqlite.SQLiteException:Can ' t downgrade database From version 7
01-14 20:29:22.290:e/androidruntime (2722): at Android.database.sqlite.SQLiteOpenHelper.onDowngrade ( sqliteopenhelper.java:361)
01-14 20:29:22.290:e/androidruntime (2722): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked ( sqliteopenhelper.java:255)
01-14 20:29:22.290:e/androidruntime (2722): at Android.database.sqlite.SQLiteOpenHelper.getReadableDatabase ( sqliteopenhelper.java:188)
01-14 20:29:22.290:e/androidruntime (2722): at Com.android.deskclock.provider.ClockProvider.query ( clockprovider.java:96)
01-14 20:29:22.290:e/androidruntime (2722): at Android.content.ContentProvider.query (contentprovider.java:922)
01-14 20:29:22.290:e/androidruntime (2722): at Android.content.contentprovider$transport.query ( contentprovider.java:213)
01-14 20:29:22.290:e/androidruntime (2722): at Android.content.ContentResolver.query (contentresolver.java:462)
01-14 20:29:22.290:e/androidruntime (2722): at Android.content.ContentResolver.query (contentresolver.java:405)
01-14 20:29:22.290:e/androidruntime (2722): at Com.android.deskclock.provider.AlarmInstance.getInstances ( alarminstance.java:188)
01-14 20:29:22.290:e/androidruntime (2722): at Com.android.deskclock.alarms.AlarmStateManager.FixAlarmInstancesForReboot (alarmstatemanager.java:684)
01-14 20:29:22.290:e/androidruntime (2722): at Com.android.deskclock.alarminitreceiver$1.run ( alarminitreceiver.java:102)
01-14 20:29:22.290:e/androidruntime (2722): at Android.os.Handler.handleCallback (handler.java:808)
01-14 20:29:22.290:e/androidruntime (2722): at Android.os.Handler.dispatchMessage (handler.java:103)
01-14 20:29:22.290:e/androidruntime (2722): at Android.os.Looper.loop (looper.java:193)
01-14 20:29:22.290:e/androidruntime (2722): at Android.os.HandlerThread.run (handlerthread.java:61)
2. Analysis results:
As can be seen from the log above, this type of exception is caused by the database cannot be degraded, at which time the factory reset can return to normal.      3. Solution You can circumvent the problem by overriding the Ondowngrade () method of the parent class Sqliteopenhelper.java in Databasehelper.java, or modify the method directly in Sqliteopenhelper.java.
Public
void Ondowngrade (sqlitedatabase db, int oldversion, int newversion) {
throw new SQ Liteexception ("Can ' t downgrade database from version" +
oldversion + "to" + NewVersion);}




About OTA upgrade exception analysis due to database not degraded after upgrading from high to low version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.