Building your first Couchbase Lite Android app

This tutorial shows you how to use Couchbase Lite in your Android apps and includes instructions for getting started with either Android Studio or Eclipse development environments. This tutorial assumes you are familiar with developing software for Android devices. If you are new to Android development, take a look at the free training classes for developers available on the Android website before beginning to work with Couchbase Lite.

The tutorial walks through creating a simple Hello World-style app called HelloWorld. By following the tutorial, you'll learn how to create a new Couchbase Lite Android app, create a database, and interact with the database by using basic CRUD (create, read, update, and delete) operations.

To make it easier to learn the basics and get started with Couchbase Lite, the program structure is highly simplified. HelloWorld does not have a UI and all code is placed in the MainActivity class. All output is sent to the console rather than the display in the Android simulator. Rest assured, the TodoLite and GrocerySync sample Android apps do not take these shortcuts—they incorporate standard Android software design and development practices.

You can follow along with the tutorial and build the HelloWorld app yourself, or you can download the HelloWorld code from GitHub.


Create a new project with Android Studio
Create a new Couchbase Lite project in Android Studio
Create a new project with Eclipse
Create a new Couchbase Lite project in Eclipse
Adding starter code
Import Couchbase Lite headers and start writing the HelloWorld app
Creating the manager and a database
Create a manager and a database for HelloWorld
Performing CRUD operations
Create, retrieve, update, and delete documents in the HelloWorld database