This is how the Android-maven-plugin module should work in order to add a library project to a dependency of your main project, add the following dependency to your main pom.xml project:
<dependencies> <dependency> <groupId>com.company.common.lib</groupId> <artifactId>common-lib</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> </dependencies>
Note that this is different from the usual jar dependencies, apklib is just the zip of all your src and res folders, which have a standard Android / Eclipse library project library structure structure ( src/com/... instead of src/main/java/com/... ). The reason for this is support for using apklib in other unmotivated projects (for more details see the ApkLib documentation ). You do not add your library as a compiled jar dependency; instead, you add your library dependency as source code and resources, simply from a zip file.
When you run mvn clean install on the target android-maven-plugin:3.0.0:generate-sources , the android-maven-plugin will unzip your apklib dependency and merge the source code and resources into your main project before compiling your project; this is how Android library projects should work. A library project is not just a compilation of everything. To save memory and disk space, only used parts are copied and compiled into the final apk. You can easily override resources in the main project, as they simply replace the library material at the merge stage until the final compilation.
This is ugly, but at the moment everything works, the Android Dev team is currently working on it and will support jar dependencies in the future, possibly in r17 (which also requires changing / updating the Android-maven-plugin)), in more detail in its official blog post " Changes to library projects in Android SDK Tools, r14 ."
yorkw
source share