Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.iosphere:sqlite-android:3.12.2'
}
dependencies {
implementation("com.github.iosphere:sqlite-android:3.12.2")
}
<dependency>
<groupId>com.github.iosphere</groupId>
<artifactId>sqlite-android</artifactId>
<version>3.12.2</version>
</dependency>
libraryDependencies += "com.github.iosphere" % "sqlite-android" % "3.12.2"
:dependencies [[com.github.iosphere/sqlite-android "3.12.2"]]
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:
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'
}
libsqliteX.so
:ReLinker.loadLibrary(context, "sqliteX");
System.loadLibrary("sqliteX");
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.
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
ndk-build
step to make the build process more transparent.