Create a new project with Eclipse

This lesson describes how to set up the Couchbase Lite environment with Eclipse.

Set up the environment

Before you can build an app, you need to set up your development environment. To get set up with Eclipse, you can use one of the following methods:

Create a new project

  1. Launch Eclipse.

  2. Select File > New > Android Application Project.

  3. In the New Project window, enter the application name, module name, package name, and project location.

    This example uses HelloWorldEclipse for the application name.

  4. Set the minimum required SDK to API 9: Android 2.3 (Gingerbread) or later and use the currently recommended Android API.

    After you fill in the fields, the New Project window should look something like this:

    New Eclipse project
  5. Click Next, and then move through the remaining setup screens and enter settings as necessary (or just accept the defaults).

  6. When you get to the last setup screen, click Finish.

  7. Open the AndroidManifest.xml file (it’s located at the root level of your project directory), and add the following line to the file as a child of the <manifest> element.

    <uses-permission android:name="android.permission.INTERNET" />
  8. Save the AndroidManifest.xml file.

Add Couchbase Lite

  1. Download the latest version of Couchbase Lite from

  2. Decompress the zip file.

  3. In the decompressed folder, find the cbl_collator_so-{version}.jar file, rename it to cbl_collator_so-{version}.zip, and then decompress it.

  4. Copy all the folders in the /cbl_collator_so-{version}/libs folder into the libs folder in the HelloWorldEclipse project.

    Note:You need to extract and copy these files manually because Eclipse cannot handle JARs that contain native libraries. For more information about this limitation, see Android issue 17861.
  5. Copy all the remaining JAR files from the /couchbase-lite-{version} folder into the project libs folder, except for the couchbase-lite-android-source-{version}.jar.

    You do not need to copy any .aar and .pom files from the folder.

After you copy all the files into the libs directory in your Eclipse project, its content should look similar to the following figure:

libs folder contents

Build and run the app

Running the empty app at this point verifies whether the dependencies are set up correctly. The app won’t run properly if you have Android Studio running simultaneously with the ADT bundle Eclipse.

  1. Click Run and verify the app runs properly.

  2. When requested, start the emulator.

    You should see the app start in the emulator and the text “Hello World” in the app window, similar to the following figure:

    Emulator display