Mavenizing android projects

I must confess, I like building my java apps with maven because I really hate managing all the dependencies, and on the other side I can use great tools like sonar and jenkins/hudson out of the box.

So the goal was to build my android project with maven.  First stop was of course the official android-maven url:

In the getting started it was pretty clear to install jdk, android sdk, maven and that’s about it. I’ve created my pom file like they said:


In the project I’m talking about, I’m using android 1.6. After mvn clean install I had my first problem.

1. Maps not found

package does not exist

So that was pretty clear that I only have “clean” android installed (or at least in my mvn repo). After a quick google search, I’ve found out about mvn android sdk deployer ( That seemed to be the answer to my problems. Yup, just clone the repo, mvn clean install it and you’re ready to go. But after running mvn clean install (for maven android sdk deployer) I’ve got the following error:

2. addon-google_apis-google-3/ not found

Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project google-apis-3: Properties file not found: /Users/vuknikolic/dev/android-sdk-mac_x86/add-ons/addon-google_apis-google-3/ -> 

This one confused me, I knew that I had google add-on installed for v3, I’ve checked the path, but it wasn’t there. Then I saw on maven-android-sdk-deployer’s github page:

Platforms and Add on folder names changes in SDK

When updating an existing android sdk install the add-ons subfolder can sometimes be reused and their contents be updates so you could end up with e.g. the google maps-4r2 in a folder named google_apis-4_r01. To work around this just uninstall the affected add-on and reinstall it with the android sdk tool.

After that android mvn deployer worked like a charm, great works guys. So I’ve returned to my project, started mvn clean install… and…

3. JSON not found?

package org.json does not exist

This one seemed weird, cause why on earth would I miss something inside of android sdk? If it is installed already… My good friend Google saved me again (, there seems to be a problem with 1.6_r2 package as well, so I had to upgrade it to 2.1.2 as advised in that issue.

After that I was finally building my android project with maven. So here are the five easy steps to start building your android project (that uses google maps) with maven:

  1. Create pom.xml and set version to 2.1.2 or above in maven dependency
  2. Clone maven-android-sdk-deployer
  3. Uninstall old installed versions with Android SDK manager and install them again (just to make your life easier)
  4. Start mvn clean install in maven-android-sdk-deployer
  5. Start mvn clean install in your project

Twitter bootstrap and Google maps v3

I was playing around with excellent twitter bootstrap and google maps javascript api (version 3), and for some time I had problem with displaying infowindows (“map bubbles”).

Everything went smooth, markers were animated (and in right position), click events were working, except that info windows were looking pretty strange.

As you can see something went wrong with css, I saw that somehow google’s image is not showing as it should.
After some hacking I found out that bootstrap defined this (with some other properties):

img {
    max-width: 100%;

but gmaps isn’t handling that as it should.

So the answer is to override that property for your google map div (#gmap is div’s name in my project)

#gmap img {
    max-width: none;

And here is the result (the bubble is ok, with text, close button, pointer… everything :))

It looks pretty simple, but it took me some time to find it out, because my first suspect was my own code. In the end I was surprised that it wasn’t up to me :)

I hope this will help somebody :)

klopaj! for android

My second application for VIP Android Challenge 1.0. Klopaj! lets you search entire Belgrade for the best restaurants. Just enter type of food, or restaurant’s name or whatever you would like and let klopaj show you where it is. You can comment restaurants, added them to your favorites, love them or not. App is powered by website.

This application also won a HTC Tattoo phone, that I’m currently using :)