title: SQLite-db corrupt only on Android 2.2
body: <p>I'm using <a href="http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/" rel="nofollow noreferrer">this</a> method to copy a pre-existing sqlite-database from my assets-directory to the app's /databases/-directory on the first app launch. This works fine on emulators with different SDK-levels and on my 4.4 devices, but fails on a 2.2.2 device with the following logcat message:</p>
  <p><code>sqlite returned: error code = 11, msg = database corruption found by source line 40107</code>
  and further on <code>SELECT locale FROM android_metadata failed</code></p>
  <p>There are other SO-questions with this error, but my database definitely contains an <code>android_metadata</code>-table with a <code>locale</code> column and an <code>en_US</code> entry (which is why the app works on many other emulators and higher-SDK devices) and isn't large (32KB), which I read can be an issue.</p>
  <p><strong>Update:</strong> I switched to using the <a href="https://github.com/jgilfelt/android-sqlite-asset-helper" rel="nofollow noreferrer">SQLiteAssetHelper-library</a>, but am still getting the same error:</p>
  <blockquote>
  <p>copying database from assets...</p>
  <p>database copy complete</p>
  <p>sqlite returned: error code = 11, msg = database corruption found by source line 40107</p>
  <p>sqlite returned: error code = 11, msg = database disk image is malformed</p>
  <p>CREATE TABLE android_metadata failed</p>
  <p>Failed to setLocale() when constructing, closing the database</p>
  </blockquote>
  <p>It seems the <code>SQLiteOpenHelper</code> (not the <code>AssetHelper</code>) is trying to create the <code>android_metadata</code> table (even though it's already present) and fails because of this?</p>
  <p><strong>Update 2:</strong> The full stacktrace can be found <a href="http://pastebin.com/qRQgQ0cJ" rel="nofollow noreferrer">here</a></p>