Android - database disk image is malformed

前端 未结 3 656
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 21:10

In my android app I am getting \"database disk image is malformed\" What are the reasons for getting this error?

not closed db? multiple threads accessing the db? or

3条回答
  •  一个人的身影
    2020-12-15 21:18

    I've come across many instances of people reporting sqlite corruption issues on Android. The majority of times it's related to a task killer but there is still a small margin of people still experiencing random SQLite corruption.

    For example, this issue: http://code.google.com/p/android/issues/detail?id=4866

    JRL's links above are also very useful for understanding what types of events can lead to a corrupted SQLite DB image.

    Also, SQLite itself has been patched in recent history to resolve various (rare) data corruption scenarios. See http://www.sqlite.org/changes.html. So the version of SQLite that ships with Android isn't the latest, but as Android evolves, so do the apps that are bundled with it, such as SQLite.

    At the end of the day, there's only so much we can do as programmers to safeguard against SQLite corruption so its sometimes advantageous to code safety mechanisms into our apps, such as periodic DB backups to SDCard (that's what I do).

提交回复
热议问题