Saturday, December 22, 2012

[SOLVED] Unfortunately, Clock has stopped

This solution was published on the hajma blog. Pavel Heimlich deserves full credit here, but I am reposting it for convenience as it was an extremely simple fix for my Galaxy S2 running Cyanogenmod 10. Incidentally, the reason I had an error was that I lost my data connection due to some update and didn't have a recent backup, so I had to go back to a stock install of the OS. When I was restoring programs with Titanium Backup I noticed that, for some reason, Clock was not installed, so I installed it too. Then I got the above error. I use my phone as an alarm and really needed this back, hence the search for the procedure I've posted below.

When I upgraded my xperia ray from CM7 to CM9(FXP128), I was greeted by the message 'Unfortunately, Clock has stopped' whenever the phone started and anytime I touched the Clock widget. Apart from being annoying it meant I couldn't set my alarms so this became a priority one issue :-)

I opened the Terminal Emulator and typed:


$ su 
# logcat

Then I held 'Volume down' (a.k.a. Ctrl) and 'c' to stop the output. I scrolled a bit up in the output and found a line that said:

E/SQLiteOpenHelper( 5231): Couldn't open alarms.db for writing (will try read-only): E/SQLiteOpenHelper( 5231): android.database.sqlite.SQLiteException: Can't downgrade database from version 7 to 5

OK, so this is where it's breaking. I wasn't really interested in finding out what should the proper combination of ownership/permissions for the file as I didn't really trust it would end just here, downgrading database version offers a range of situations that can go wrong. And since I don't really care for my past alarm clock times, I got rid of the old database:

# cd /data/data/com.android.deskclock/databases 
# mv alarms.db alarms.db.bak 

Problem solved.


Thanks Pavel!

8 comments:

  1. Worked perfectly!
    Thank you for sharing c:

    ReplyDelete
  2. Well done. You're saying to simply delete the app's cache (if any) and data. I can't tell you how often that exact fix could fix problems that cause people unknowable frustration, yet many just don't think of it for some reason.

    ReplyDelete
  3. I'm using stock unrooted galaxy grand duos running on android 4.1.2. any way to fix it? terminal emulator doesnt seem to help since I dont have root access. tried clearing cache and rebooting. still doesnt work. -_-

    ReplyDelete
    Replies
    1. I couldn't say for sure what happened in your case, but one thing is for sure... You'll need to root the phone and install the terminal emulator if you want to fix it. As another commenter pointed out, it doesn't matter if the situation leading up to the error is the same, the fix will be.

      Delete
  4. My clock stopped working and I cannot set the alarms. This method worked once for me, but the problem returned, and I could not fix it anymore. Nevertheless, there is something strange I saw. I deleted the caches, the data, do junk cleansing on the my phone, disabled the phone and re-enabled it. After these steps, I saw that the most current alarm settings disappeared, and the alarm settings of some time ago returned. I suspect there are hidden backup/cache/whatever files that the clock is clinging to, that prevents the clock from going back to normal, that I need to delete. Can anybody help?

    ReplyDelete