Android fmod Release

Hello!
I’m just posting this here to help, in case anyone runs into some of the same issues I did.

I’m working on the Android version of my project, after having done iOS first.
I’m using fmod for audio.

Thanks to fmod docs, some posts here and on fmods forums, I was able to include the binary fmod libs in my project and get it working. However, I was not able to run release, and was banging my head against a wall for quite some time on that. Finally, I found, almost by fluke, in the logcat window in Android Studio:

2019-11-13 17:18:19.922 27558-27558/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.gmayer.spacepigmathandroid, PID: 27558
    java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.gmayer.spacepigmathandroid-Yf14Zd_4oSYOdb2cGC-LeA==/lib/arm/libfmod.so"
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1669)
        at org.cocos2dx.cpp.AppActivity.<clinit>(Unknown Source:2)
        at java.lang.Class.newInstance(Native Method)

So then at least I knew there was some problem loading the lib.

Finally, thanks to these:


I found that it was something to do with my FMOD proguard configuration.

Turns out, adding the following line to app/proguard-rules.pro fixed it!!

-keep class org.fmod.** { *; }

(thanks Mathew at fmod!)

Hopefully that helps someone!

For me it means spacepigmath.com is one step close to being on all Android devices :slight_smile:

cheers
Greg

3 Likes

Hi. Thanks for sharing. cocos audio engine is simple and we are searching for alternative.
Do you suggest FMOD for android and iOS?

You’re welcome :slight_smile:
In fairness, FMOD is the only sound engine I’ve ever used, so I can’t give an exhaustive overview, but, that being said, it is excellent. I’ve used it at work, and on personal projects, since 2006. I created a thin wrapper to my game, and use fmod studio. Time to add a completely new sound effect and hear it in game is a few minutes.