No sharedpreferences or db file
I am developing application that uses shared preferences and content provider. But everytime I enter my application my shared preferences and db data are not there.
I am using acra for error reporting and from logs it seems it also have trouble accessing file:
10-05 21:19:00.868 E/ApplicationContext(11683): Couldn't rename file /dbdata/databases/x.x.x/shared_prefs/x.x.x_preferences.xml to backup file /dbdata/databases/x.x.x./shared_prefs/x.x.x_preferences.xml.bak
also database have hard time inserting data, here is an error:
开发者_运维百科10-05 21:19:01.770 E/Database(11683): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
I have no idea what is creating this bug. It only happens on my phone, it works fine on emulator.
Here is phone spec: Model number.. Samsung-sgh-i997 Firmware.. 2.2.1 Baseband.. I997UCKH1 kernel.. 2.6.32.9 Build.. FROYO.UCKH1
There's a buggy version of samsung ROMs. I have one... It affects Froyo 2.2.1 editions.
I can't find something else than this question right now.
Just keep looking for samsung and shared preferences and you will find more.
Basically there's a bug which causes your application to lose write pemission to your shared preferences. There's no pattern, it happens sometimes with all kind of apps and deletion of the affected folder and reinstall of the app always solves the problem (at least for me). This was driving me insane until I found out...
The database error is something else and I don't think that it relates to the first problem. You should check which constraint fails. Seems like a wrong query to me. Search for the affected code and post it here (try to narrow it down to the minimum required code)...
精彩评论