Android maven project with a native dependency

In my current Android project we’re using the Android maven plugin and recently we got a pre-built native library (.so) as a dependency.

I had some trial and errors and had to read the plugin’s source code to get it working, the project’s wiki about it isn’t up-to-date on how to do it.

First, as this native dependency is not in a Maven repository, we’re using the maven install plugin to install it in the local maven repository:



It is important to set the packaging as “so” and set the classifier with the shared-object’s target architecture. In our case it is “armeabi” but the plugin also recognize these others: “armeabi-v7a”, “mips” and “x86”.

After getting the dependency installed you’ll list it under your <dependencies> like this:


That’s it, after running mvn clean package the generated APK should have the .so:

$ jar tf app/target/app.apk | grep armeabi