A newer version of this documentation is available.

View Latest

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.

      Quick Steps

      For experienced developers, this is all you need to add Couchbase Lite for Android 3.1.10 to your application projects.

      Kotlin - Enterprise
      1. Create a Kotlin Android app project in Android Studio

      2. Add Couchbase Lite as a dependency in your app-level build.gradle
        implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.1.10'

      3. Add the following maven repo to your repositories (in build.gradle or settings.gradle as required
        https://mobile.maven.couchbase.com/maven2/dev/

      4. Build the project and it will pull Couchbase Lite down.

      Kotlin - Community
      1. Create a Kotlin Android app project in Android Studio

      2. Add Couchbase Lite as a dependency in your app-level build.gradle
        implementation 'com.couchbase.lite:couchbase-lite-android-ktx:3.1.10'

      3. Check you have mavenCentral() in repositories (or in settings.gradle)

      4. Build the project and it will pull Couchbase Lite down.

      Java - Enterprise
      1. Create a Java Android app project in Android Studio

      2. Add Couchbase Lite as a dependency in your app-level build.gradle
        implementation 'com.couchbase.lite:couchbase-lite-android-ee:3.1.10'

      3. Add the following maven repo to your repositories (in build.gradle or settings.gradle as required
        https://mobile.maven.couchbase.com/maven2/dev/

      4. Build the project and it will pull Couchbase Lite down.

      Java - Community
      1. Create a Java Android app project in Android Studio

      2. Add Couchbase Lite as a dependency in your app-level build.gradle
        implementation 'com.couchbase.lite:couchbase-lite-android:3.1.10'

      3. Check you have mavenCentral() in repositories (or in settings.gradle)

      4. Build the project and it will pull Couchbase Lite down.

      That’s it! You''re all set to begin developing powerful Couchbase Lite applications.

      Now, try the Getting Started application, which demonstrates use of key CRUD functionality.

      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

      1. 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
        }
      2. Include the following in the repositories {} section:

        repositories {
          maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' }
        
        //   ... other section content as required by user
        }
      3. Include the following in the dependencies{} section:

        dependencies {
        
          implementation 'com.couchbase.lite:couchbase-lite-android-ee-ktx:3.1.10'
        
        //   ... other section content as required by user
        }
      1. 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
        }
      2. Ensure your repositories section includes mavencentral()

        repositories {
        
          mavenCentral()
        
          //   ... other section content as required by user
        }
      3. Add Couchbase Lite to the dependencies{} section:

        dependencies {
        
          implementation "com.couchbase.lite:couchbase-lite-android-ktx:3.1.10"
        
        //   ... other section content as required by user
        }

      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

      1. 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
        }
      2. Add the following in the repositories {} section:

        repositories {
          maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' }
        
        //   ... other section content as required by user
        }
      3. Add Couchbase Lite to your dependencies{} section:

        dependencies {
        
          implementation 'com.couchbase.lite:couchbase-lite-android-ee:3.1.10'
        
        //   ... other section content as required by user
        }
      1. 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
        }
      2. Ensure your repositories section includes mavencentral()

        repositories {
        
          mavenCentral()
        
          //   ... other section content as required by user
        }
      3. Include the following in the dependencies{} section:

        dependencies {
          implementation 'com.couchbase.lite:couchbase-lite-android:3.1.10'
        //   ... other section content as required by user
        }