Installing Couchbase Lite on Android
Description — How to install Couchbase Lite on Android
Abstract — Getting you up and running quickly with Couchbase Lite on android
Introduction
Couchbase Lite on Android supports the development of applications in Java or Kotlin.
You can install Couchbase Lite Community and-or Enterprise editions from the Maven repository. There are separate downloads for Kotlin and Java.
Enterprise users can also download the Couchbase Lite Vector Search extension library. Installation instructions are included in the step-by-step install guides for both Java and Kotlin.
Kotlin - Step-by-Step Install
More detailed instructions on getting up and running with Couchbase Lite for Android (Kotlin).
The Kotlin download also includes the Java version of Couchbase Lite for Android, along with the other dependencies. |
Create or open an existing Android Studio project and include the following entries in the app-level build.gradle
file (typically in the app folder).
-
Enterprise Edition
-
Community Edition
-
Include the following in the
android {}
section:android { // Required only if your project has some Kotlin source code kotlinOptions { jvmTarget = 1.8} compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } // ... other section content as required by user }
-
Include the following in the
repositories {}
section:repositories { maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' } // ... other section content as required by user }
-
Include the following in the
dependencies{}
section:dependencies { implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.2.1' // ... other section content as required by user }
-
Set the Java Version, include the following in the
android {}
section:android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } // ... other section content as required by user }
-
Ensure your
repositories
section includesmavencentral()
repositories { mavenCentral() // ... other section content as required by user }
-
Add Couchbase Lite to the
dependencies{}
section:dependencies { implementation "com.couchbase.lite:couchbase-lite-android-ktx:3.2.1" // ... other section content as required by user }
Kotlin Vector Search Extension: Detailed Installation Instructions
You can get set up with the Vector Search Extension for Android (Kotlin) by following these instructions.
The Kotlin download also includes the Java version of Couchbase Lite for Android, along with the other dependencies. |
Create or open an existing Android Studio project and include the following entries in the app-level build.gradle
file (typically in the app folder).
You must have Couchbase Lite installed before you can use the Vector Search Extension. Vector Search is available only for 64-bit architectures. The Vector Search extension is an Enterprise-only feature. |
Installing the Vector Search Extension
-
Include the following in the
android {}
section:android { // Required only if your project has some Kotlin source code kotlinOptions { jvmTarget = 1.8} compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } // ... other section content as required by user }
-
Include the following in the
repositories {}
section:repositories { maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' } google() mavenCentral() // ... other section content as required by user }
-
For architectures other than x86_64:
dependencies { implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.2.1' // All standard 64-bit ARM architectures implementation 'com.couchbase.lite:couchbase-lite-android-vector-search-arm64-1.0.0' // ... other section content as required by user }
-
For x86_64 architectures:
dependencies { implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.2.1' implementation 'com.couchbase.lite:couchbase-lite-android-vector-search-x86_64-1.0.0' // ... other section content as required by user }
-
-
To activate the extension, the snippet below is required:
try { CouchbaseLite.enableVectorSearch(); }
catch (CouchbaseLiteException e) {
throw new IllegalStateException("Could not enable vector search", e);
}
Java - Step-by-step Install
More detailed instructions on getting up and running with Couchbase Lite for Android (Java).
Create or open an existing Android Studio project and install Couchbase Lite using the following method.
Include the following entries to the app-level build.gradle
file (typically in the app folder).
-
Enterprise
-
Community
-
Set the Java Version, include the following in the
android {}
section:android { // Required only if your project has some Kotlin source code kotlinOptions { jvmTarget = 1.8} compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } // ... other section content as required by user }
-
Add the following in the
repositories {}
section:repositories { maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' } // ... other section content as required by user }
-
Add Couchbase Lite to your
dependencies{}
section:dependencies { implementation 'com.couchbase.lite:couchbase-lite-android-ee:3.2.1' // ... other section content as required by user }
-
Include the following in the
android {}
section:android { // Required only if your project has some Kotlin source code kotlinOptions { jvmTarget = 1.8 } compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } // ... other section content as required by user }
-
Ensure your
repositories
section includesmavencentral()
repositories { mavenCentral() // ... other section content as required by user }
-
Include the following in the
dependencies{}
section:dependencies { implementation 'com.couchbase.lite:couchbase-lite-android:3.2.1' // ... other section content as required by user }
Java Vector Search Extension: Detailed Installation Instructions
The Vector Search extension is an Enterprise-only feature. |
You can get set up with the Vector Search Extension for Android (Java) by following these instructions.
Create or open an existing Android Studio project and install Couchbase Lite using the following method.
Include the following entries to the app-level build.gradle
file (typically in the app folder).
Installing the Vector Search Extension
To use Vector Search, you must have Couchbase Lite installed and add the Vector Search extension to your Couchbase Lite application. Vector Search is available only for 64-bit architectures and Intel processors that support the Advanced Vector Extensions 2 (AVX2) instruction set. To verify whether your device supports the AVX2 instructions set, follow these instructions. |
-
Include the following in the
android {}
section:android { // Required only if your project has some Kotlin source code kotlinOptions { jvmTarget = 1.8} compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } // ... other section content as required by user }
-
Include the following in the
repositories {}
section:repositories { maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' } google() mavenCentral() // ... other section content as required by user }
-
Include the following in the
dependencies{}
section:dependencies { implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.2.1' // All standard 64-bit ARM architectures implementation 'com.couchbase.lite:couchbase-lite-android-vector-search-arm64-1.0.0' // ... other section content as required by user }
-
For running on x86_64 architectures, include the following in the
dependencies{}
section instead:dependencies { implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.2.1' implementation 'com.couchbase.lite:couchbase-lite-android-vector-search-x86_64-1.0.0-1.0.0' // ... other section content as required by user }
-
-
To activate the extension, the snippet below is required:
try { CouchbaseLite.enableVectorSearch(); } catch (CouchbaseLiteException e) { throw new IllegalStateException("Could not enable vector search", e); }