0

The android.database.sqlite documentation displays the SQLite version for each API level of Android except for the latest API level 28.

I'm currently targeting API 28 in my app and am looking to use the feature to rename a table column ALTER TABLE table RENAME COLUMNlaunched in SQLite version 3.25. Because there is no SQLite version mentioned in the documentation for 28 does that mean I'm currently using the last one mentioned, 3.19?

I'm also wondering how often Android updates the SQLite library used.

AdamHurwitz
  • 9,758
  • 10
  • 72
  • 134
  • 1
    `adb shell && sqlite3 --version` would tell it for certain. – Martin Zeitler Oct 08 '18 at 16:42
  • The adb shell command no longer works. Instead, execute this Kotlin code on the device ```val version = SQLiteDatabase.create(null).use { DatabaseUtils.stringForQuery(it, "SELECT sqlite_version()", null) } println("Framework (API ${Build.VERSION.SDK_INT}) SQLite version: $version")``` – Mark May 02 '21 at 04:07
  • The accepted answer is incorrect. The actual answer is 3.22 as confirmed here (which has been updated since the question was posted): https://developer.android.com/reference/android/database/sqlite/package-summary.html – Mark Jul 15 '22 at 01:38

1 Answers1

-2

It doesn't specify it for every version of android, it leaves out any where it doesn't change. So I'd assume 28 uses the same as 27.

Note that historically they only update SQLite every 3 version or so, and had a 10 version gap from 11 to 21

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Since Lollipop, it's been updated almost every single version. – Mark Dec 22 '18 at 08:38
  • @Mark Their own documentation doesn't even say that- they claim to have updated it for 11, 21, 24, 26, 27. At best they've updated every version for 2 in a row. – Gabe Sechan Dec 22 '18 at 15:39
  • their own documentation omits micro updates (and hasn't even been updated for 28 yet). Since Lollipop, only once has the same SQLite version been used as in the previous Android version https://stackoverflow.com/a/4377116/444761 (which mentions that 28 certainly does not use the same version as 27) Disclaimer: I've been maintaining that SO answer for the past 8 years. – Mark Dec 23 '18 at 04:28
  • @Mark if it isn't I their documentation, I wouldn't depend on it being anything other than the previous version. You have no idea if the devices you tested on were psyched I the official version and universal, or by the oem. You might get lucky, but I would only count on the feature set promised by the docs of course it is very easy to include your own, more recent version, I've done this to ship with different feature flags – Gabe Sechan Dec 23 '18 at 04:32
  • It's true that you shouldn't depend on anything - and that includes their documentation. The versions given in my answer are based on the emulators and those versions also correspond to the versions given in Android's documentation up to and including 27. But I think it's strange to assume that the version for 28 is the same as 27, rather than the version in the 28 emulator. Also, my answer gives anomalies (as you suggested might exist), whereas Android's documentation does not. So we have evidence that Android's documentation is less accurate. – Mark Dec 23 '18 at 04:36
  • Update 2021.05: The official documentation still has not been updated to reflect the latest API levels. For API levels after 27, better to use the versions given in my answer to the similar question: https://stackoverflow.com/questions/2421189/version-of-sqlite-used-in-android – Mark May 02 '21 at 04:05
  • Update 2021.06: The official documentation has been updated for APIs 28, 30 & 31. All of them confirm the SQLite versions given in my answer to the other SO question. This confirms what I have been claiming in my comments above. @Gabe – Mark Jun 24 '21 at 04:37