Strange Shared Preferences Loss

Since recently deciding to try and avoid developing on the emulator I’ve come across a super annoying bug within Android which would basically lock you from being able to write to the shared preferences of your app. Examples are abound but basically installing your app over an existing version of the app on your device will potentially muck with the permissions in the shared preferences space. This may not always be a problem except if you read/write from that space. The reason it has suddenly become noticed since trying to avoid developing on the emulator is that I use the “Run” button as I did with the emulator and I believe that using this way of overwriting the existing version eventually causes this issue.

However, according to some of the posts with similar symptoms, end users were experiencing the issue on app upgrade!

While developing recently I ran into this problem and it drove me crazy. I had spent some time trying to trouble shoot restarting the device, my dev machine, Eclipse, the ADB; all to no avail. Uninstalling the app didn’t work either.

I eventually got a work around where I was able to delete the shared preferences directory and its contents which then reinstalling the app allowed it to function correctly. After this point I am trying to uninstall the app and then install it — via command line script.

This entry was posted in Programming and tagged , . Bookmark the permalink.

Comments are closed.