Skip to content

Ready-built recent SQLite bindings to be used inside Android applications and libraries for Android 4.1 (API 16) and above. Supported architectures: [armeabi-v7a, mips, x86]

License

Notifications You must be signed in to change notification settings

iosphere/sqlite-android

Repository files navigation

sqlite-android

Ready-built recent SQLite bindings to be used inside Android applications and libraries for Android 4.1 (API 16) and above. Supported architectures: [armeabi-v7a, mips, x86]

If you wanted to use more recent SQLite features inside you Android application, like:

you might be out of luck with the older version of SQlite provided by Android, which does not allow you to load custom SQLite extensions, for example.

Therefore sqlite-android includes and uses the SQlite Android bindings provided by the SQlite project sqlite.org itself.

The SQlite Android bindings provided by SQlite contain a modified copy of the official Android SQlite bindings provided by Android by using a different Java namespace org.sqlite.database.sqlite instead of the official Android namespace android.database.sqlite. Since the interfaces of both libraries are the same, using sqlite-android should be just a change of an import statement to point to the correct library.

By using the SQlite Android bindings, sqlite-android is able to pull in the latest SQlite library using the SQlite amalgamation sources and enabling additional SQlite features like:

Usage

Check https://jitpack.io/#iosphere/sqlite-android for the most recent version available.

build.gradle dependencies:
allprojects {
	repositories {
	  ...
	  maven { url "https://jitpack.io" }
	}
}

dependencies {
  // recent SQlite version
  compile 'com.github.iosphere:sqlite-android:3.12.2'

  // sane shared library loading on Android (optional but recommended)
  compile 'com.github.KeepSafe:ReLinker:1.2.1'
}
Load shared library libsqliteX.so:

ReLinker.loadLibrary(context, "sqliteX");

  • Without ReLinker:

System.loadLibrary("sqliteX");

Project setup

ndk-build is invoked on a CI-server building the native SQlite library libsqliteX.so. These built artefacts are checked in and the build is tagged with the SQlite version, which was build.

Afterwards jitpack.io is used to build an Android library project (aar), which you can include in your project.

How to use a different SQlite version

  • Change the SQlite sources sqlite.h and sqlite.c
  • cd library/src/main/jni
  • ndk-build
  • git add library/src/main/libs
  • git add library/src/main/jni/sqlite/sqlite.h
  • git add library/src/main/jni/sqlite/sqlite.c
  • git commit
  • git tag 3.12.2
  • git push --tags

License

  • Copyright (c) Jan Weitz 2016, The Apache Software License, Version 2.0 (See LICENSE.txt)
  • It uses the SQLite Android bindings, which are under Public Domain
  • The SQlite Android bindings contain a modified copy of the Android sourcecode, which is licensed under the Apache License, Version 2.0. The license is preserved in the source files.

TODO

  • Use a public travis CI to do the ndk-build step to make the build process more transparent.
  • Naming scheme for git tags for different SQlite features.

Inspired by

About

Ready-built recent SQLite bindings to be used inside Android applications and libraries for Android 4.1 (API 16) and above. Supported architectures: [armeabi-v7a, mips, x86]

Resources

License

Stars

Watchers

Forks

Packages

No packages published