Include Native *.so Library in APK With Android Studio

Using the Android NDK is well documented throughout the internet if you are still using Eclipse. The process is basically the same with Android Studio until the time comes to build your APK. The APK will build fine, but your library *.so file will be missing from the APK and when you attempt to load it with System.loadLibrary(“mylibrary”) you will get:

java.lang.UnsatisfiedLinkError: Couldnt load mylibrary from loader dalvik.system.PathClassLoader

You can view the contents of your APK with the following command to verify is not in the APK:

unzip -l MyApp.apk

Android Studio’s build tool will not look in the usual place:

SharedLibrary :
Install : => libs/armeabi/

The trick (thanks to this thread:!msg/adt-dev/nQobKd2Gl_8/Z5yWAvCh4h4J) is to move to:


Voila, your native code is now compiled into your APK. This should work with build tools 0.8+


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s