# Android NDK: UnsatisfiedLinkError when calling libfmod.so and using Proguard

**URL:** <https://qa.fmod.com/t/android-ndk-unsatisfiedlinkerror-when-calling-libfmod-so-and-using-proguard/12147>\
**Category:** FMOD Engine\
**Created:** [November 11, 2015, 9:25pm UTC](https://qa.fmod.com/t/android-ndk-unsatisfiedlinkerror-when-calling-libfmod-so-and-using-proguard/12147 "2015-11-11T21:25:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyone](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@Kyone](https://qa.fmod.com/u/Kyone)\
**Post date:** [November 11, 2015, 9:25pm UTC](https://qa.fmod.com/t/android-ndk-unsatisfiedlinkerror-when-calling-libfmod-so-and-using-proguard/12147/1 "2015-11-11T21:25:00Z")

</div>

Hi’re,

I’m getting an `UnsatisfiedLinkError` exception when calling `System.loadLibrary("fmod");` and using Proguard. It works fine without Proguard on.

In both cases, the `libfmod.so` exists in the `lib/arm` directory of the APK.

I’m using Android Studio with gradle. I activate Proguard with the `minifyEnabled` property set to `true`.

Do you guys have any idea of what’s going on?

Thanks!

The code in `Main.java`:

```
static {
    System.loadLibrary("fmod");
    System.loadLibrary("fmodstudio");
    System.loadLibrary("Main");
}

```

The log:

```
E/AndroidRuntime: FATAL EXCEPTION: main
E/AndroidRuntime: Process: com.<snip>, PID: 20003
E/AndroidRuntime: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.<snip>/lib/arm/libfmod.so"
E/AndroidRuntime: at java.lang.Runtime.loadLibrary(Runtime.java:371)
E/AndroidRuntime: at java.lang.System.loadLibrary(System.java:988)
E/AndroidRuntime: at com.<snip>.<clinit>`
```

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 11, 2015, 11:01pm UTC](https://qa.fmod.com/t/android-ndk-unsatisfiedlinkerror-when-calling-libfmod-so-and-using-proguard/12147/2 "2015-11-11T23:01:20Z")

</div>

FMOD native code will call out to the fmod.jar, we verify this is possible in JNI\_OnLoad. When you obfuscate the fmod.jar there is no way for the native code to find the necessary methods so it returns a JNI\_ERR.

I think you just need to exclude the fmod.jar from ProGuard, a quick Google reveals this [stack overflow](http://stackoverflow.com/questions/7721397/how-to-make-proguard-ignore-external-libraries) page that discusses how to do it.

---

<div class="post-metadata">

**Author:** ![Kyone](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@Kyone](https://qa.fmod.com/u/Kyone)\
**Post date:** [November 11, 2015, 11:10pm UTC](https://qa.fmod.com/t/android-ndk-unsatisfiedlinkerror-when-calling-libfmod-so-and-using-proguard/12147/3 "2015-11-11T23:10:24Z")

</div>

> [@](#):
>
> FMOD native code will call out to the fmod.jar, we verify this is possible in JNI\_OnLoad. When you obfuscate the fmod.jar there is no way for the native code to find the necessary methods so it returns a JNI\_ERR.
> 
> I think you just need to exclude the fmod.jar from ProGuard, a quick Google reveals this [stack overflow](http://stackoverflow.com/questions/7721397/how-to-make-proguard-ignore-external-libraries) page that discusses how to do it.

Thanks Mathew! I had to change my FMOD proguard configuration:  
from `-keepclassmembers class org.fmod.** { *; }`  
to `-keep class org.fmod.** { *; }`
