简体   繁体   中英

System.loadLibrary get stuck and never returns

Our game stalls as it loads our main library under Android with API level 15 (or 14, haven't test previous versions). This does not occur on device with API level 16 and above.

We are using the NDK so our Main.java includes the following lines at its end:

static {
    boolean bFMODReady = false;
    try {
      System.loadLibrary("fmod");
      System.loadLibrary("fmodstudio");
      bFMODReady = true;
    } catch (UnsatisfiedLinkError e) {
        Log.e(TAG, "Unable to load FMOD (" + e.getLocalizedMessage() + ")");
    }

    if (BuildConfig.AMAZON) {
        System.loadLibrary("AmazonGamesJni");
    }

    System.loadLibrary("Main");

    if (!bFMODReady) {
        Log.e(TAG, "FMOD is not ready -> disable audio");
        disableAudio();
    }
}

The game stalls at launch with the following log:

05-05 00:30:39.017 598-598/com.snip.snap D/dalvikvm: Trying to load lib /mnt/asec/com.snip.snap-1/lib/libMain.so 0x4175c7e8

Nothing more. According to previous logs, fmod, fmodstudio and AmazonGamesJni libraries load just fine.

Obviously the loading of libMain.so get stuck for whatever reason. We are compiling our libraries against c++_static (with the APP_STL value from the Application.mk file). We also are using Proguard and multidex.

Here are what we tried to fix the issue but failed:

  • compile against either c++_shared , gnustl_static or gnustl_shared ;
  • deactivate some of the static libraries we are linking our libMain against. Since it's a very lengthy operation we did deactivate just a very few;
  • deactivate proguard

What can we do to track down the issue?

Thanks for your help

SO reference:

We figured out that the problem came from a native OpenGL call which was deadlocking.

The takeaway here is to connect your native gdb debugger and break somewhere in your native code to know what's going on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM