Setting up a Continuous Build for an Android Project

Grab the latest Android SDK. At the time of writing r23.0.2:

$ wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
$ tar xvfz android-sdk_r23.0.2-linux.tgz

Set ANDROID_HOME to the freshly extracted directory and change into it to update the sdk.

$ cd ${ANDROID_HOME}
$ cd tools
$ ./android update sdk --no-ui

Add a global variable ${ANDROID_HOME} in you Jenkins installation. On a 64 bit Linux system you may need to do some extra steps:

My first research in the web suggested to install ia32-libs.

$ sudo apt-get install ia32-libs

Those packages were in the meantime replaced by lib32z1 and others. So I tried:

$ sudo apt-get install lib32z1 lib32z1-dev

Still troubled waters:

Output:
    /var/lib/jenkins/possum/android-sdk-linux/build-tools/20.0.0/aapt: error while loading shared libraries: libstdc++.so.6: cannot open shared object  file: No such file or directory

So I finally ended up with the following apt-get install:

$ sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev

Create a Gradle build job which uses the gradle wrapper and execute the tasks clean build.

./gradlew clean build

Finally we got the desired output:

Finished: SUCCESS