Disabled binaries required in Android build

Hi,

FMOD seems to be disabling required binaries during the build. When building and running my Unity project on android, I run into the following error message:

java.lang.UnsatisfiedLinkError: [...] couldn't find "libfmodL.so"
[...]
FMODUnity.RuntimeUtils.EnforceLibraryOrder ()
FMODUnity.RuntimeManager.get_Instance ()
FMODUnity.RuntimeManager.PathToGUID (System.String path)
FMODUnity.RuntimeManager.GetEventDescription (System.String path)
FMODUnity.StudioEventEmitter.Lookup ()
FMODUnity.StudioEventEmitter.Play ()
[...]

The mentioned library is indeed missing in the apk (as is libfmodstudioL.so). I traced this back to FMOD disabling the respective binary explicitly in Settings.SelectBinaries() before the build by calling (importer as PluginImporter).SetCompatibleWithPlatform(target, false);. I reenabled the binary, commented out the respective line so it would not be disabled and voilá, the exception disappears.

Now I wonder: What is the purpose of disabling these binaries and how come it happens with binaries that are apparently required? Is the problem with the libraries being disabled, or with them being required? The binaries are not very large, so does my workaround even have a downside?

I am using:

  • Unity 2020.1.17f1
  • FMOD 2.1.9 (plugin and studio)
  • Target Architecture ARM64 (Oculus Quest 2)
  • IL2CPP
  • .NET Standard 2.0
  • API level 26

My suspicion is that for some reason the import settings on your android .so libraries haven’t been included for the “Android” platform. Could you please check your import settings for “Assets\Plugins\FMOD\lib\android\arm64-v8a\libfmodL.so” and make sure the “Android” checkbox is ticked?


The idea behind picking and choosing libraries is so we don’t bloat up people’s applications with junk they don’t need.
There is definitely an issue however if we are stripping libraries you do need, and there have been a couple of cases like this recently so while you’re here I might grab some more information from you if you don’t mind?

  • In this project, have you upgraded from an older version of FMOD to 2.01.09 or is this a fresh studio project?
  • Also in this project, have you migrated to a new Unity version at any point?
  • Did you change from Mono to IL2CPP for this project or was IL2CPP the default?
  • Did you change to .NET Standard 2.0 or was this the default?
  • Did you change to API level 26 or was this the default?
  • Did you use the fmodstudio20109.unitypackage to install the FMOD integration or did you drag in the Assets\Plugins\FMOD folder from another project?

Don’t worry if you are unsure about any of the answers, I would appreciate any extra insights into your project to help figure out what is going on!

Hi,

exactly my suspicion. However, attempting to reactivate the library was frustrating, because the code I mentioned runs at the beginning of the build and simply deactivates the library again. So yeah, the import settings are wrong, but the reason is the code in Settings.SelectBinaries() . It seems to deem the library unsupported or optional and I am not sure why. It refers to some ScriptableObjects of type Platform. I found those, but they weren’t very illuminating.

I appreciate the effort for junk reduction. I think I can leave my workaround in place for now. But I’d prefer to understand how this happens to prevent it properly.

As for your questions:

  • The project started with 2019.2.0b3 and was periodically upgraded to end up at 2020.1.17f1
  • FMOD was added Nov. 2020 when the project was at Unity 2020.1.15f1 so only minor Unity upgrades afterwards.
  • I don’t remember the FMOD version then, it was definitely 1.xx.xx . It did work okay after upgrading to version 2, though.
  • IL2CPP was activated later (I think FMOD was still at version 1 then, not sure). Could be a reason…
  • for android .Net Standard was always 2.0
  • API level was increased to 26 only recently. Could be a reason…
  • I installed by dragging in the unitypackage file.

The project is already a few days old and I might have moved/reconfigured files in a way I don’t quite remember…

Thanks for your support!

Thank you for the extra info, there might be some weirdness from gradually updating on a mature project which I am assuming is the case if the original FMOD version predates 2.00.00. Definitely keep doing what you’re doing if it’s working properly, if you upload a reproduction then I can take a closer look at your setup; that might be easier than back-and-fourthing until I recreate the issue. If you go to your profile there is an Upload section- I probably don’t need the FMOD Studio project, just a stripped out Unity project with built banks and the error ocurring.

Hi Jeff,
I think I won’t manage to strip down the project to a reasonable size and still have it build successfully (which it must to produce the error). I know that’s not ideal and the issue seems difficult to reproduce. I’ll try and find the time to investigate further and let you know about what I find.

Thank you for your support!