[Bug][2.02.06] Android startup crash

Build in Unity 2021.2.15f1.

Right after app start we get this CRASH:
2022-05-23 16:43:56.063 18138-18138/***** E/.FMOD.OutputAAudioHeadphonesChanged() (tried Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged and Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged__)
2022-05-23 16:43:56.064 18138-18138/
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ****, PID: 18138
java.lang.UnsatisfiedLinkError: No implementation found for void org.fmod.FMOD.OutputAAudioHeadphonesChanged() (tried Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged and Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged__)
at org.fmod.FMOD.OutputAAudioHeadphonesChanged(Native Method)
at org.fmod.FMOD.access$000(Unknown Source:0)
at org.fmod.FMOD$PluginBroadcastReceiver.onReceive(Unknown Source:0)
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1666)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

This only happens on some devices but also not always. But it has a 8/10 likelihood to crash.

We did not receive this crash when we ware on 2.02.04. We upgraded to 2.02.06 as it fixed out IL2CPP issues.

This is a major issue for us.

This error probably indicates a missing lib. If you open up the apk (rename the “.apk” part to “.zip” and then unzip it and navigate to “lib{architecture}”, are any fmod .so libraries present?
If there is, how big is the library? If there is not, can you please check the import settings for libfmod.so and libfmodstudio.so for that platform inside Unity, and make sure it is set to be included on Android? e.g

All the libs are in the apk/aab.

We investigated the issue some more and found its correlated to USB-C Headphones.

  • Disconnect Headphones
  • Reboot Device
  • Launch APP
    => no Crash, Working sound
  • Connect Headphones
    => no Crash, Working sound on headphones
  • Close App
  • Launch App
    => Crash on startup
  • Disconnect Headphones
  • Launch App
    => Crash on startup

From this point on, even with the headphones disconnected the app will crash. After a restart of the device it will work until the headphones get connected once before the app Launches.
It is not required for the crash that the heads are connected during the running of the app.

Device: Samsung Galaxy S20 5G (Sm-G9810)
Android: 11 (RP1A.200720.012.G9810ZHS3DUL3)
Headphones: Samsung EO-IC100

Thanks for the extra info- I haven’t been able to reproduce this issue on a device with USB-C headphones. Would it be possible for you to upload a reproduction to your FMOD Profile? Just a debug build of your APK with API Error Logging enabled and the Logging Level set to “Log” should be sufficient.
There was a change to the AAudio headset detection code in 2.02.06 which might relate to this issue. In the FMOD Unity Settings, can you please try setting your Output Mode for the “Android” platform to “OpenSL” and tell me whether you still get a crash?

We tried OpenSL, and still the same error.

We have a Debug build with full error logging ready. How to share this link with you in privet? The seems to be now PM option.

Thank you for preparing that- if you could please upload it to your FMOD Profile I will take a look through and try to reproduce the issue.

I uploaded the build.

Thank you for the reproduction, we are able to reproduce this issue as you have described. Everything seems to be indicating a fault in the headset detection code, which as I mentioned previously came in at 2.02.06. While we investigate this issue, would it be possible for you to move back to the 2.02.05 version of the integration to continue development?

We upgraded to 2.02.06 as we need this fix:
Unity - Fixed il2cpp crash caused by CREATESOUNDEXINFO callbacks not being marshaled when loading sounds from audio tables.

Is there a estimate on how long until a version with a fix to this issue becomes available ?

Unfortunately we have no estimate on when a fix for this issue will become available.

There is a workaround for this particular issue in 2.02.05 that you can try, which is to explicitly null out any unused exinfo callbacks before calling System.createSound. More details on this workaround are available here FMOD programmer sounds no longer work Unity 2021.2.* - #5 by jeff_fmod

Good day! I want to add that we have similar issue with Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged with version 2.02.03. Interesting thing that it reproduces only on Xiaomi devices with Android 11 version when app goes foreground after some time in background. Is it sounds familiar to you? May be it’s already fixed in the latest version?
Also I want to add that we don’t use createSound method, so we can not use offered workround.

Strange that you are getting this in 2.02.03. Does this issuse occur in 2.02.05?

We don’t have released version of the app with FMOD 2.02.05 at the moment. We are waiting for particular Xiaomi devices to come to test it ourselves.

Started getting this crash on 2.02.07. Tested on OpenSL too, still crashing.

We have found that this issue reproduces in 2.02.06 when there are no FMOD Studio Listener components in the first scene. We are currently working on a fix for this which should be available in the next release. In the meantime, can you please confirm whether you have any FMODUnity components (StudioListener, StudioEventEmitter etc) in your first scene? If you do not, does adding one prevent the crash?

Yes, there is a FMOD listener and event emitters present in the first scene. However, I did a mistake and left a Unity Audio Listener component in a new camera I created for the UI at build time. Removing it didn’t fix the issue for subsequent builds, as they keep crashing in the same manner at the opening of the game. Somewhere in this timeframe before the crashes starting happening I tested the game with headphones plugged on, possibly at build time. Only time I have got the app not crash since then was when I plugged the headphones just as the game was launching.

Hello every one. Did you guys found the way out. I’m facing the exact same issue.
I’m using FMOD version 2.02.07 and other details are given below.

OS : Android 12

java.lang.Error: FATAL EXCEPTION [main]
Unity version     : 2020.3.32f1
Device model      : Xiaomi M2101K6G
Device fingerprint: Redmi/sweet_global/sweet:12/SKQ1.210908.001/V13.0.8.0.SKFMIXM:user/release-keys
Build Type        : Release
Scripting Backend : IL2CPP
ABI               : arm64-v8a
Strip Engine Code : true

Caused by: java.lang.UnsatisfiedLinkError: No implementation found for void org.fmod.FMOD.OutputAAudioHeadphonesChanged() (tried Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged and Java_org_fmod_FMOD_OutputAAudioHeadphonesChanged__)
	at org.fmod.FMOD.OutputAAudioHeadphonesChanged(Native Method)
	at org.fmod.FMOD.access$000(FMOD.java:18)
	at org.fmod.FMOD$PluginBroadcastReceiver.onReceive(FMOD.java:168)
	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1694)
	at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(Unknown Source:2)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:210)
	at android.os.Looper.loop(Looper.java:299)
	at android.app.ActivityThread.main(ActivityThread.java:8168)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1037)