Delayed FMOD initialization - for fix crash on Android 8.0

Hi FMOD (Unity 2019.1.13f1) generating a random crashing on all Android 8.0 devices from AAudio API. Android 8.1 and other version works fine. For us will be the best quick solution to use OPENSL output for Android API-26.
We tryed to change the output in first Awake in Unity, bust it’s too late, because FMOD is already initialized. Ofcourse, is possible to modify RuntimeManager.cs, but it’s not a clear solution.

We using FMOD 2.00.04.

Here is crashlog:

2019-09-10 20:51:19.227 13621-13694/com.company.game E/AndroidRuntime: FATAL EXCEPTION: UnityMain
    Process: com.company.game, PID: 13621
    java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000000000000
    Build fingerprint: 'HONOR/LLD-L31/HWLLD-H:8.0.0/HONORLLD-L31/121(C432):user/release-keys'
    Revision: '0'
    pid: 13621, tid: 14167, name: Binder:13621_6  >>> com.company.game <<<
        x0   000000733f5171c8  x1   000000736ccb49c0  x2   0000000000000001  x3   0000000000000002
        x4   0000000000000104  x5   0000000000000000  x6   0000000000000000  x7   0000007362618a80
        x8   000000733f517108  x9   00000000000000c0  x10  0000000000000008  x11  0000000000000000
        x12  000000734ec3b298  x13  000000734ec3b2d0  x14  000000736cae7320  x15  0000000000000000
        x16  000000736d2f1368  x17  00000073707dd758  x18  0000000013040000  x19  0000000000000000
        x20  000000736ccb49c0  x21  000000733f5171c8  x22  0000000000000000  x23  00000073707e0f14
        x24  000000734ec3b570  x25  000000734eb3f000  x26  0000000000000000  x27  0000000000000000
        x28  0000000000000000  x29  000000734ec3b350  x30  000000736d2a7a2c
        sp   000000734ec3b330  pc   00000073707dd774  pstate 0000000060000000
        at [vdso].(:0)
        at libutils._ZNK7android7RefBase9decStrongEPKv(_ZNK7android7RefBase9decStrongEPKv:24)
        at libbinder._ZN7android14IPCThreadState20processPendingDerefsEv(_ZN7android14IPCThreadState20processPendingDerefsEv:136)
        at libbinder._ZN7android14IPCThreadState14joinThreadPoolEb(_ZN7android14IPCThreadState14joinThreadPoolEb:52)
        at libbinder.(:0)
        at libutils._ZN7android6Thread11_threadLoopEPv(_ZN7android6Thread11_threadLoopEPv:280)
        at libandroid_runtime._ZN7android14AndroidRuntime15javaThreadShellEPv(_ZN7android14AndroidRuntime15javaThreadShellEPv:136)
        at libc._ZL15__pthread_startPv(_ZL15__pthread_startPv:36)
        at libc.__start_thread(__start_thread:68)
1 Like

I can confirm, that changing the output to OPENSL in RuntimeManager.cs works. Adding this lines to RuntimeManager.cs:198 is a quick solution for this crashes:

        #if !UNITY_EDITOR && UNITY_ANDROID
        if (SystemInfo.operatingSystem.Contains("API-26"))
            outputType = FMOD.OUTPUTTYPE.OPENSL;
        #endif
1 Like

Michal You are a time saver, I face the same problem, unity 2019.02.06 + FMOD 2.00.04, Crash on android 8.0 when the game switches from background to foreground; I follow your method and the problem is solved! thanks!

I solved it thanks to you.

Is it a bug?Is there anyother solution fot it?
For AAUDIO is Default on android 8.0 and above。