Android does not load libfmodstudio.so

Hi!
I am using fmod studio in unity it works ok on osx and ios. But when I’m building for Android I got the following error:

D/dalvikvm( 4367): Trying to load lib /mnt/asec/com.ctdlgames.sonder6-2/lib/libfmodstudio.so 0x40f10d28
E/dalvikvm( 4367): dlopen("/mnt/asec/com.ctdlgames.sonder6-2/lib/libfmodstudio.so") failed: Cannot load library: find_library(linker.cpp:889): “/mnt/asec/com.ctdlgames.sonder6-2/lib/libfmodstudio.so” failed to load previously
I/Unity ( 4367): AndroidJavaException: java.lang.UnsatisfiedLinkError: Cannot load library: find_library(linker.cpp:889): “/mnt/asec/com.ctdlgames.sonder6-2/lib/libfmodstudio.so” failed to load previously
I/Unity ( 4367): java.lang.UnsatisfiedLinkError: Cannot load library: find_library(linker.cpp:889): “/mnt/asec/com.ctdlgames.sonder6-2/lib/libfmodstudio.so” failed to load previously

Any idea what might be causing this? Any help is appreciated.

Cheers!

Can you please specify which version of FMOD you are using and what version of Android you are running on. Have you confirmed that libfmodstudio.so is inside the APK (it can be opened with any zip file program) in the lib directory.

I am using unity integration ver. 1.08.05. Originally I have tried it on Android 4.2 and it didnt work. But today I run the same build on Android 4.3 and it was working fine. I checked the apk file and the library is there.

I tried an android 4.2.2 virtual device and it worked. Can you specify the device. Are there any earlier log messages that give a reason for the library not loading?

This is the first occurence of “libfmodstudio.so” and “libfmod.so” in my log file:

D/dalvikvm( 2448): Trying to load lib /mnt/asec/com.ctdlgames.sonder6-1/lib/libfmodstudio.so 0x422699f0
E/dalvikvm( 2448): dlopen("/mnt/asec/com.ctdlgames.sonder6-1/lib/libfmodstudio.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library “libfmod.so” needed by “libfmodstudio.so”; caused by load_library(linker.cpp:745): library “libfmod.so” not found

and later (I think it might be relevant):

D/dalvikvm( 2448): Shared lib ‘/mnt/asec/com.ctdlgames.sonder6-1/lib/libfmod.so’ already loaded in same CL 0x422699f0

Obviously I checked and “libfmod.so” is present in the apk file.

I’am using colorovo CityTab Lite Model No.: CVT-CTL-7-DC#2.1

Also i have found this log

D/dalvikvm( 2561): Added shared lib /mnt/asec/com.ctdlgames.sonder6-1/lib/libfmod.so 0x42261d78

AFTER the first log from my previous post. This might cause the error?

Can you check to make sure the code in RuntimeUtils.EnforceLibraryOrder() is being run before any code that tries to use the FMOD libraries.

Yep that was it. Strange that it was working on some androids but not on others. Anyways - thanks for support!

Automatic dependency loading was added in Android 4.4. Can you say what code was accessing FMOD functions before calling RuntimeUtils.EnforceLibraryOrder(), was it our code or yours?

Adding the previously mentioned call on Awake() did the job and first sounds are played in Start() function in my project so i suppose it was your code, it is hard for me to tell exact line thou.

Solved in the comments by explicitly calling RuntimeUtils.EnforceLibraryOrder() in the awake() phase of Unity. This issue only affects Android phones before 4.4.