Skip to content

Initializing a Build Environment

f2prateek edited this page Feb 12, 2013 · 4 revisions

UPDATE - I found a comprehensive guide if you want to learn more about the maven build process.

The build requires Maven v3.0.3+ and the Android SDK to be installed in your development environment. In addition you'll need to set the ANDROID_HOME environment variable to the location of your SDK. Maven will automate the process of compiling and assembling the apklib, jars, and apks, as well as run automated tests.

NOTE: Maven is NOT required to build this application. You can impor the project in eclipse and add its dependencies as library projects and/or jars.

In general, the complete setup required for compilation requires the following steps:

  • Set up the JDK
  • Set up the Android SDK
  • Set up Maven

Setting up the JDK

If the JDK is not already installed on your computer, grab it from http://www.oracle.com/technetwork/java/javase/downloads/index.html and follow the instructions. Add a variable from JAVA_HOME on your system. The install location is different on every platform, so do a search for "java home [platform]" with your platform for more instructions.

Setting up the Android SDK

Download the latest version of the Android ADT bundle - https://developer.android.com/sdk/index.html. Note that the ADT bundle isn't needed, just the SDK Tools (under use an existing IDE) will be fine, since we will be using IntelliJ anyways. The procedure (and commands) will be same either way. Unpack the jar file to your home folder, and rename the folder to android-sdk (any other location is fine as well, but the the commands I'll show will assume the home directory as the location).

  • UNIX; run the following commands
export ANDROID_HOME=~/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
  • Windows
  1. Add a user variable $ANDROID_HOME to the location of your SDK
  2. Append your path with
$ANDROID_HOME/tools;$ANDROID_HOME/platform-tools

Setting up Maven

Building

  • Run mvn clean package from the app directory to build the APK only
  • Run mvn clean install from the root directory to build the app and also run the integration tests, this requires a connected Android device or running emulator
Clone this wiki locally