Sqlite

The androidx.sqlite library contains abstract interfaces along with basic implementations which can be used to build your own libraries that access SQLite.

You might want to consider using the Room library, which provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.

Latest Update Stable Release Release Candidate Beta Release Alpha Release
August 10, 2022 2.2.0 - - 2.3.0-alpha04

Declaring dependencies

To add a dependency on SQLite, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    def sqlite_version = "2.2.0"

    // Java language implementation
    implementation "androidx.sqlite:sqlite:$sqlite_version"

    // Kotlin
    implementation "androidx.sqlite:sqlite-ktx:$sqlite_version"

    // Implementation of the AndroidX SQLite interfaces via the Android framework APIs.
    implementation "androidx.sqlite:sqlite-framework:$sqlite_version"
}

Kotlin

dependencies {
    val sqlite_version = "2.2.0"

    // Java language implementation
    implementation("androidx.sqlite:sqlite:$sqlite_version")

    // Kotlin
    implementation("androidx.sqlite:sqlite-ktx:$sqlite_version")

    // Implementation of the AndroidX SQLite interfaces via the Android framework APIs.
    implementation("androidx.sqlite:sqlite-framework:$sqlite_version")
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 2.3.0

Version 2.3.0-alpha04

August 10, 2022

androidx.sqlite:sqlite:2.3.0-alpha04, androidx.sqlite:sqlite-framework:2.3.0-alpha04, and androidx.sqlite:sqlite-ktx:2.3.0-alpha04 are released. Version 2.3.0-alpha04 contains these commits.

API Changes

  • Updated nullability (I29fbd)

Version 2.3.0-alpha03

June 1, 2022

androidx.sqlite:sqlite:2.3.0-alpha03, androidx.sqlite:sqlite-framework:2.3.0-alpha03, and androidx.sqlite:sqlite-ktx:2.3.0-alpha03 are released. Version 2.3.0-alpha03 contains these commits.

API Changes

  • Make androidx.sqlite.ProcessLock restricted. The API is scoped and limited to its function within androidx.sqlite and should not be used as a general purpose multi-process lock. (I1643f)

Version 2.3.0-alpha02

April 6, 2022

androidx.sqlite:sqlite:2.3.0-alpha02, androidx.sqlite:sqlite-framework:2.3.0-alpha02, and androidx.sqlite:sqlite-ktx:2.3.0-alpha02 are released. Version 2.3.0-alpha02 contains these commits.

  • No significant changes since 2.3.0-alpha01

Version 2.3.0-alpha01

February 23, 2022

androidx.sqlite:sqlite:2.3.0-alpha01, androidx.sqlite:sqlite-framework:2.3.0-alpha01, and androidx.sqlite:sqlite-ktx:2.3.0-alpha01 are released. Version 2.3.0-alpha01 contains these commits.

API Changes

  • Add an API in SupportSQLite's configuration to allow data loss during the recovery mechanism. (I1b830, b/215592732)
  • Added API for multi-process lock and usage at the FrameworkSQLite* level, to protect multi-process 1st time database creation and migrations. (Ied267, b/193182592)

Version 2.2.0

Version 2.2.0

December 15, 2021

androidx.sqlite:sqlite:2.2.0, androidx.sqlite:sqlite-framework:2.2.0, and androidx.sqlite:sqlite-ktx:2.2.0 are released. Version 2.2.0 contains these commits.

Important changes since 2.1.0

Add default method for execPerConnectionSQL() in SupportSQLiteDatabase.

Version 2.2.0-rc01

December 1, 2021

androidx.sqlite:sqlite:2.2.0-rc01, androidx.sqlite:sqlite-framework:2.2.0-rc01, and androidx.sqlite:sqlite-ktx:2.2.0-rc01 are released. Version 2.2.0-rc01 contains these commits.

No significant changes since 2.2.0-beta01.

Version 2.2.0-beta01

October 13, 2021

androidx.sqlite:sqlite:2.2.0-beta01, androidx.sqlite:sqlite-framework:2.2.0-beta01, and androidx.sqlite:sqlite-ktx:2.2.0-beta01 are released. Version 2.2.0-beta01 contains these commits.

  • No changes from previous alpha version.

Version 2.2.0-alpha02

July 21, 2021

androidx.sqlite:sqlite:2.2.0-alpha02, androidx.sqlite:sqlite-framework:2.2.0-alpha02, and androidx.sqlite:sqlite-ktx:2.2.0-alpha02 are released. Version 2.2.0-alpha02 contains these commits.

No significant changes since 2.2.0-alpha01. This release is just to align with Room 2.4.0-alpha04 release.

Version 2.2.0-alpha01

June 16, 2021

androidx.sqlite:sqlite:2.2.0-alpha01, androidx.sqlite:sqlite-framework:2.2.0-alpha01, and androidx.sqlite:sqlite-ktx:2.2.0-alpha01 are released. Version 2.2.0-alpha01 contains these commits.

API Changes

  • Add default method for execPerConnectionSQL() in SupportSQLiteDatabase (I86326, b/172270145)

Version 2.1.0

Version 2.1.0

January 22, 2020

androidx.sqlite:sqlite:2.1.0, androidx.sqlite:sqlite-framework:2.1.0, and androidx.sqlite:sqlite-ktx:2.1.0 are released with no changes since 2.1.0-rc01. Version 2.1.0 contains these commits.

Important changes since 2.0.1

  • Support for useNoBackupDirectory which can be used to indicate that the database should be created in the no backup directory when using SupportSQLiteOpenHelper.

Version 2.1.0-rc01

January 8, 2020

androidx.sqlite:sqlite-*:2.1.0-rc01 is released. Version 2.1.0-rc01 contains these commits.

This release is identical to 2.1.0-beta01.

Version 2.1.0-beta01

December 4, 2019

androidx.sqlite:sqlite:2.1.0-beta01, androidx.sqlite:sqlite-framework:2.1.0-beta01, and androidx.sqlite:sqlite-ktx:2.1.0-beta01 are released with no changes since 2.1.0-alpha01. Version 2.1.0-beta01 contains these commits.

Version 2.1.0-alpha01

November 7, 2019

androidx.sqlite:sqlite:2.1.0-alpha01, androidx.sqlite:sqlite-framework:2.1.0-alpha01, and androidx.sqlite:sqlite-ktx:2.1.0-alpha01 are released. Version 2.1.0-alpha01 contains these commits.

API changes

  • Added a new property to SupportSQLiteOpenHelper.Configuration called useNoBackupDirectory to indicate that a file based database should be created and located from the no backup directory.

Version 2.0.1

Version 2.0.1

March 13, 2019

Version 2.0.1 of the androidx.sqlite artifact group is released with two bug fixes.

Bug Fixes

  • Fixed two issues where FrameworkSQLiteOpenHelper wouldn’t properly recover from a corrupted database or a bad migration during initialization. (b/111504749 and b/111519144)