Android 中使用的 SQLite 版本? [英] Version of SQLite used in Android?

查看:54
本文介绍了Android 中使用的 SQLite 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android 中使用的 SQLite 版本是多少?

What is the version of SQLite used in Android?

原因:我想知道如何处理架构迁移.较新的 SQLite 版本支持ALTER TABLE"SQL 命令,这样我就不必复制数据、删除表、重新创建表和重新插入数据.

Reason: I'm wondering how to handle schema migrations. The newer SQLite versions support an "ALTER TABLE" SQL command which would save me having to copy data, drop the table, recreate table and re-insert data.

推荐答案

以下是官方文档的链接,其中包含此答案中的要点:android.database.sqlite 包级 javadoc

Here is a link to the official docs which include the main points in this answer: android.database.sqlite package-level javadoc

Kotlin 代码获取框架 SQLite 版本:

Kotlin code to get framework SQLite version:

val version = android.database.sqlite.SQLiteDatabase.create(null).use {
    DatabaseUtils.stringForQuery(it, "SELECT sqlite_version()", null)
}
println("Framework (API ${Build.VERSION.SDK_INT}) SQLite version: $version")

使用模拟器(注意,实际设备上的 SQLite 版本将至少指定):

Using the emulators (note, SQLite version on actual devices will be at least that specified):

<头>
API 级别*版本名称SQLite注意事项
3112S3.32.2
3011R3.28.0窗口函数
2910Q3.22.0
289饼图3.22.0
278.1奥利奥3.19.4参见 3.19.3版本控制签入,因为3.19.4链接不存在
268.0奥利奥3.18.2O 测试版使用 3.18.0
257.1.1牛轧糖3.9.2
247.0牛轧糖3.9.2
236.0棉花糖3.8.10.2M 预览版 1(SDK 级别 22)使用 3.8.10
225.1.1棒棒糖3.8.6.1参见 3.8.6版本控制签入因为3.8.6.1链接不存在
215.0棒棒糖3.8.6
204.4W.2Android Wear未知没有可用的模拟器,但可能是 3.7.11 或 3.8.4.3
194.4奇巧3.7.11
184.3果冻豆3.7.11
174.2果冻豆3.7.11
16**4.1果冻豆3.7.11
154.0.3冰淇淋三明治3.7.4
14**4.0冰淇淋三明治3.7.4
133.2蜂窝3.7.4
123.1蜂窝3.7.4
11**3.0蜂窝3.7.4
102.3.3姜饼3.6.22
92.3.1姜饼3.6.22
8**2.2弗罗约3.6.22
72.1泡芙3.5.9
41.6甜甜圈3.5.9
3**1.5纸杯蛋糕3.5.9
API level* Version Name SQLite Notes
31 12 S 3.32.2
30 11 R 3.28.0 window functions
29 10 Q 3.22.0
28 9 Pie 3.22.0
27 8.1 Oreo 3.19.4 see 3.19.3 and version control check-ins because 3.19.4 link does not exist
26 8.0 Oreo 3.18.2 O beta versions used 3.18.0
25 7.1.1 Nougat 3.9.2
24 7.0 Nougat 3.9.2
23 6.0 Marshmallow 3.8.10.2 M Preview 1 (SDK level 22) used 3.8.10
22 5.1.1 Lollipop 3.8.6.1 see 3.8.6 and version control check-ins because 3.8.6.1 link does not exist
21 5.0 Lollipop 3.8.6
20 4.4W.2 Android Wear unknown no emulator available, but probably either 3.7.11 or 3.8.4.3
19 4.4 KitKat 3.7.11
18 4.3 Jelly Bean 3.7.11
17 4.2 Jelly Bean 3.7.11
16** 4.1 Jelly Bean 3.7.11
15 4.0.3 Ice Cream Sandwich 3.7.4
14** 4.0 Ice Cream Sandwich 3.7.4
13 3.2 Honeycomb 3.7.4
12 3.1 Honeycomb 3.7.4
11** 3.0 Honeycomb 3.7.4
10 2.3.3 Gingerbread 3.6.22
9 2.3.1 Gingerbread 3.6.22
8** 2.2 Froyo 3.6.22
7 2.1 Eclair 3.5.9
4 1.6 Donut 3.5.9
3** 1.5 Cupcake 3.5.9

* Android API 级别链接显示 android.database.sqlite 包已更改.如果没有链接(例如 API 级别 17),则表示该包没有更改.

* Android API level links show where the android.database.sqlite package has changed. Where there is no link (e.g. API level 17), indicates no changes to that package.

** 损坏的 SDK 链接,请参阅此处

** Broken SDK link, see here

注意:如果您希望您的应用在所有 Android 版本中使用相同版本的 SQLite,请考虑使用 Requery 的 第 3 方 SQLite 支持库SQLCipher(如果您还需要加密).

Note: if you want your app to use the same version of SQLite across all Android versions, consider using Requery's 3rd party SQLite support library or SQLCipher (if you also want encryption).

这篇关于Android 中使用的 SQLite 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆