Fork me on GitHub

Native Libraries as Dependencies

A quick guide on how to use native dependencies (of type .so) when creating an APK for Android. In an attempt reduce build times for projects involving a lot of native code, it would be useful to deploy the native libraries (.so) into the Maven Repository and only refer to them from the Maven POM of the Android application.

As of version 2.8.3, native dependencies are supported directly by the Android Maven plugin. All that is needed is to declare the dependencies. This defines the actual dependency on the native library. The library will be placed in the lib/armeabi directory within the APK.

The artifact id of the dependency will be the final name of the library when packaged in the APK. Code loading the library in this particular case would use: