In the latest two weeks, without releasing an update to my app, I have started getting a bunch of reports with corrupted databases. Below is the stacktrace. Android cannot open
In your app does you close the database before you exit the activity? Watch the logcat and check if there are any errors or warnings when you run your app.
Android deleting the database is an issue indeed.
I just realized a solution could be to use SQLJet instead of the default Android SQLite implementation.
As its name does not suggest, SQLJet is an open source Java SQLite client, and it works on Android.
The canonical Good Way to recover a corrupt database is to dump it out as SQL and then read it back in to a new database. It's dead easy with the sqlite tool:
sqlite in.db .dump | sqlite out.db
...but, of course, you need to do it in code, and I really don't know if .dump is available from anywhere.
I'd suggest that you possibly want to look in to how it's getting corrupted in the first place --- SQLite has always been rock solid for me, although I've only ever used it on the internal storage. Can you check the FAT filesystem to see whether it's corrupt? I've seen, e.g., digital cameras which will thoroughly mangle filesystem on cards in various obscure ways...