Google is committed to advancing racial equity for Black communities. See how.

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 Current Stable Release Next Release Candidate Beta Release Alpha Release
January 22, 2020 2.1.0 - - -

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:

dependencies {
    def sqlite_version = "2.1.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.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)