Category Archives: Android

Tracking the adventures of learning how to be an Android developer.

Android with Maven and the support-v4 library

Maven support in Android is sketchy at best.  Some maven artifacts have been put on maven central, but others are not, or are not up to date.   I used the maven android deployer https://github.com/mosabua/maven-android-sdk-deployer and found that it is excellent, as long as you have a full boat of SDK installed.   That means all the old versions, which you are going to need anyway.  And be sure to select the google glass preview from API 15 — the maven android deployer needs that to succeed and install later stuff.  And once in a while it may take some tricks to get that to work, like uninstalling and re-installing sdk pieces.

In the end though, I couldn’t figure out how to get the latest version of the support-v4 library.   I could get v6 to work, which is on maven central.  I probably just don’t understand the instructions on the android deployer website.   So I decided to cook it my own way.   I took the support library right from the sdk and put it in my local repository with version 999:

cd $ANDROID_HOME
mvn install:install-file -Dfile=./extras/android/support/v4/android-support-v4.jar -DgroupId=com.google.android -DartifactId=android-support-v4 -Dversion=999 -Dpackaging=jar

and referenced this in my project with:

		     
		         com.google.android
		         android-support-v4
		         999
		     

This got me past the undefined references to NavUtil and WakefulBroadcastRecevier.