Hitting The Ground Running with Android Maven Plugin

August 27, 2013

Update

In the past few months it feels like the work the Android team has put into the official gradle plugin has made gradle the best option. My side projects are now all built using gradle.


One of the most important lessons from shipping my first Android app: Android Maven Plugin saves time!

I now start all my +Android projects with the excellent maven archetypes from +akquinet AG. With just one command in the terminal, I have a fully functioning hello world app built from a CI-friendly build system. And if you prefer +JetBrains IntelliJ, the maven integration makes using their IDE a snap.

Right away, I have a lot of power. As long as I have an emulator running, I can deploy to it with one line:

mvn clean package android:deploy

But that line isn’t just deploying, it’s running a mini-pipeline:

  1. removing the old compiled class files
  2. compiling the source
  3. running the automated tests (in src/main/java)
  4. deploying to the already-running emulator

It’s fantastic stuff, and the kind of thing that brings immediate value in team settings.

Of course, that one command has a few prerequisites:

  • JDK 1.6+ is installed
  • Apache Maven is installed
  • Android SDK is installed and up-to-date
  • ANDROID_HOME environment variable is set to the Android SDK location

Note The Android Gradle plugin is moving along quickly, but doesn’t quite seem to be mature enough for projects with tight deadlines. I’m excited to try it out on a real project once it stabilizes a bit more.


Profile picture

Written by @sghill, who works on build, automated change, and continuous integration systems.