What is the version of SQLite used in Android?
Reason: I\'m wondering how to handle schema migrations. The newer SQLite versions support an \"ALTER TABLE\" SQL comma
$ adb shell
$ sqlite3 --version
sqlite3 --version
3.5.9
Same on ADP1 1.6 & 2.1 emulator.
In Room you can query
SELECT sqlite_version()
RG
UPDATE OCT 2016: Here is a link to the updated official docs which includes the main points in this answer: android.database.sqlite package-level javadoc
Using the emulators:
adb shell sqlite3 --version
UPDATE: Since SDK 29 (emulator revision 8), the adb shell command gives:
/system/bin/sh: sqlite3: inaccessible or not found
Any ideas why? Issue tracker here.
SQLite 3.28.0 (window functions!):
SQLite 3.22.0:
SQLite 3.19.4 (for some reason 3.19.4 does not exist in sqlite release notes! so linking to version control check-ins instead):
SQLite 3.18.2:
SQLite 3.9.2:
SQLite 3.8.10.2:
SQLite 3.8.6.1 (SQLite link is for 3.8.6 because 3.8.6.1 does not exist for some reason):
SQLite 3.8.6:
SQLite (unknown):
SQLite 3.7.11:
SQLite 3.7.4:
SQLite 3.6.22:
SQLite 3.5.9:
Note: Android SDK level links show where the android.database.sqlite package has changed. Where there is no link (e.g. SDK level 17), indicates no changes to that package.
Note: adb command to get SQLite version only works on emulators and on devices with sqlite3 available: https://stackoverflow.com/a/3645800/444761
For other devices, see Juri's answer.
I have added an Issue #58909 to the Android Issue Tracker. Please star this if you would like to support it.
Note: if you want your app to use the same version of SQLite across all Android versions, consider using this 3rd party SQLite support library.
A short overview of the Andorid APIs and the supported SQLite versions.
The overview is from the link in Mark Carters answer.
Although the documentation gives 3.4.0 as reference number, if you execute the following sql, you'll notice that there is a much higher number of SQlite installed:
Cursor cursor = SQLiteDatabase.openOrCreateDatabase(":memory:", null).rawQuery("select sqlite_version() AS sqlite_version", null);
String sqliteVersion = "";
while(cursor.moveToNext()){
sqliteVersion += cursor.getString(0);
}
This is just a piece of quick, dirty code to retrieve the sqlite version. For instance on a HTC Hero with Android 2.1, I get: 3.5.9.
On my Nexus One with Android 2.2, I even get 3.6.22.