Last Updated: February 25, 2016
· foobraco

Using Android Library Projects with Maven

Your Android project has to have the android maven plugin in its pom.xml file in order to unpack the android library project that you are going to package as an apklib.

The first thing you have to make is go to the root directory of your Android Library Project, compress it all in a zip file, and rename to the extension apklib

The files included in this gist are the maven script to convert your new apklib file into a dependency in your maven repo and the second one is the structure to add the dependency on the android pom.xml file.

This is the script to generate the apklib in your local maven repository

mvn install:install-file \ \
  -DartifactId=mywidget \
  -Dpackaging=apklib \
  -Dversion=1.0.0 \
  -Dfile=mylib.apklib \

and this is how you add the dependency in your pom.xml