Monthly Archives: November 2009


I have been working on an Android application the past month or so. My colleagues are all using Eclipse and have been working with the tooling provided for this platform. This is a good way to get up to speed fast and produce the first prototypes of an application. Going forward though automation is required. Both for builds and for test execution.

On all other java projects we use Maven as out tool for automation so it would be a shame to throw away the good momentum by replacing this with ant in the Android project. Instead I made the decision to try the android maven plugin created by Hugo Josefson at Jayway. It's a neat little plugin to Maven and it's easy to set up without changing the project structure required by the Eclipse users.

The first step is to set up you environment. I'm using bash as my shell so I added the following line to my .bash_profile file:

It is important that this point to the root of the SDK and not to one of the platforms within. Also, I choose to use ANDROID_HOME instead of ANDROID_SDK_15 used at the maven-android-plugin documentation.

To enable your Android project to be built with Maven you need to add a pom looking like this to the project root:

In order for Maven to find the android.jar file specified as a dependency in the pom you need to install it into you local repository. You the below command:

This will set up you project to compile against Android 1.6. If your project is built against 1.5 or 2.0 you just replace the references to 1.6 with your preferred version.

Next post will show how to add maven to your Android unit test project.