This document describes how to build the Ushahidi Android app from source. Instructions are provided below for building with both Eclipse and on the command line with Ant.

You will require the following to compile and run the app (instructions for these are not included in this document):

Getting the source code

Clone the source from github. There are different branches in the git repository. The Branch structure section in the README file explains the different branches that are there.

On the command line, issue the command below to clone the repository.

git clone git://github.com/ushahidi/Ushahidi_Android.git

Setting up a Google Maps API Key

Since the Ushahidi Android app is heavily based on maps, you'll have to obtain an API Key for the mapping functionality to work properly. Google Maps Android v2 requires setting up the Google Play services SDK. This has already be done for you. You don't need to repeat the steps to set that up. The process of obtaining and adding an API key is as follows:

Building with Eclipse

1. Setup Core Library project

The Core project depends on three main libraries. These libraries come with the Ushahidi Android source. They are located in the Libraries/ folder

In Eclipse,

Note: If you fail to import any of the libraries, the build process will fail miserably.

2. Setup Ushahidi project.

You can repeat this step for the other white-labelled apps.

Now build and run Ushahidi project not the Core library project.

Building on the Command Line

1. Setup Library Projects

The Core project depends on the libraries found in Libraries/. These include:

For each of these sub-directories run the Android update library project command. For example:

$> android update lib-project -p <directory_name> -t <num>

Where <directory_name> is the library's directory, and <num> is the target number for the API level you're building for.

More details on referencing library projects when building on the command line can be found at: http://developer.android.com/tools/projects/projects-cmdline.html#ReferencingLibraryProject

2. Setup the Core Library Project

The Core project is also a library project. Run the same command as shown above on the Core/ directory.

3. Setup the Ushahidi Project

The app is built from one of the sub-directories in Themes/. Assuming you are going to use the default theme found in Themes/Ushahidi/ do the following:

$> android update project -p <path to themes/ushahidi> -t <num>

Now build using the ant command inside the Ushahidi project, not the Core project.

Note: You'll need an Android device to run the application as Google doesn't support "Google Maps v2 Android" on the emulators.