UnsatisfiedLinkError on Released Game

I’m getting a crash rate of about 3% right now for my recently released game. I haven’t seen the crash myself, but through ANRs & crashes section of Google Play, I can see the stack trace for the (by far) most common crash:

java.lang.UnsatisfiedLinkError: 
  at com.sdkbox.plugin.SDKBox.nativeInit (Native Method)
  at com.sdkbox.plugin.SDKBox.init (SDKBox.java:71)
  at com.sdkbox.plugin.SDKBoxActivity.onCreate (SDKBoxActivity.java:12)
  at org.cocos2dx.cpp.AppActivity.onCreate (AppActivity.java:35)
  at android.app.Activity.performCreate (Activity.java:6309)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1113)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2519)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2654)
  at android.app.ActivityThread.-wrap11 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1488)
  at android.os.Handler.dispatchMessage (Handler.java:111)
  at android.os.Looper.loop (Looper.java:207)
  at android.app.ActivityThread.main (ActivityThread.java:5728)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)

The crash is spread evenly across all versions of Android. I don’t understand - it works for me and it works for 97% of other people, how can the link be missing for some people? Any thoughts on what the problem could be?

We’re using SDKBox IAP, Chartboost, and Admob fyi.

I disabled Proguard, thinking that might be causing this weird linking issue. No luck, still getting a 3% crash rate - and it’s all due to this UnsatisfiedLinkError in SDKBox. I don’t know what else to try, I’m really not familiar with how linking works on Android… I’ve tested on five devices and have never gotten the crash, but 3% crash rate is extremely high - and I can’t see any pattern to which users are getting the crash.

My other games are only getting a 0.06% crash rate, 50x less! Those games also use Cocos and SDKBox, although older versions (Cocos 3.14, I believe) and they also used only In App Purchases, not ChartBoost and AdMob adverts. I’m at a loss as to what I should try.

One pattern I noticed is that the number of crash reports and the number impacted users are very similar. Most users that get a boot crash would try the game again… this indicates that users are only getting the crash once - upon retrying it, the game works for them. So I would guess that it is randomly failing 3% of the time. Arghh, frustrated! Maybe if I boot the game a bunch of times, I’ll eventually get the crash myself… though I’m not sure if that will actually help me fix it. Anyone have ideas???

The UnsatisfiedLinkError is thrown when an application attempts to load a native library like libcocos2dx.so.

you can try firebase.crashlytics to catch the issue:

https://firebase.google.com/docs/crashlytics/customize-crash-reports?hl=en#android

src/org/cocos2dx/lib/Cocos2dxActivity.java

    protected void onLoadNativeLibraries() {
        try {
            ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
            Bundle bundle = ai.metaData;
            String libName = bundle.getString("android.app.lib_name");
            System.loadLibrary(libName);
        } catch (Exception e) {

            Crashlytics.logException(e);             // ADD THIS LINE

            e.printStackTrace();
        }
    }

what’s the os version, device and more info ?

Thanks,

which cocos2d-x version are you using?

and can you share apk download url?

I’m using Cocos2d-x 3.17
APK is here: https://play.google.com/store/apps/details?id=com.dingogames.tastyplanet4

I installed the app, ran it several times, checked the adb log, and found nothing unusual.

is it crash every time on some kindof device models, from the crash statistics on Google Play

Thank you for looking at this… I don’t see any patterns in which devices are getting the crash, Google Play groups it into two different crashes, 8.0 and earlier, and 8.1 and later - but looks like the exact same crash to me. It seems evenly distributed across Android versions and devices.

I can look into this, although it’s a bit daunting to add a new library to the game when I’m already having issues with another library… possibly because I’ve configured something incorrectly (I’d be worried about causing even more problems by trying to add firebase)

i write a simple test script, try to get a detail crash log
launch -> kill -> launch -> kill

but also can’t get one crash.

SDKBox really downgrade performance of games. Mostly scenario developer faces conflict issue regarding SDKBOX and NDK Version

  • Recommend to use your own native(Java or Obj-C) integration for third party integration. It reduce your 90% crash rate.
2 Likes

Thank you for the help! Unfortunately I’m still stuck and I don’t have any more time to dedicate to this right now. Very frustrating to have such a high crash rate. Fortunately it isn’t causing negative reviews, actually our reviews are extremely high. I think the main downside to the crashes is that Google considers it “Bad Behaviour” so that could effect how much they promote us or the order we show up in search results, I’m not sure exactly. Developing on Android is just a disaster and I need to work on other things now.

If I put more work into this I’ll rip out SDKBox because I have to assume that’s where this particular issue is coming from. At least if it’s my own code I’ll get better crash reports and be more likely able to fix the issue.

can you check your $PROJECT_ROOT/proj.android/app/jni/Application.mk

if include APP_PLATFROM, and what’s the value

I was never sure what that should be set to (maybe should be same as MIN_SDK?), I left it as the default.
APP_PLATFORM := android-9

We’re using NDK 16b
We tried more recent versions, had lots of issues, I thought this was the most recent version that works with Cocos.

gradle.properties:
PROP_COMPILE_SDK_VERSION=27
PROP_MIN_SDK_VERSION=19
PROP_TARGET_SDK_VERSION=27
PROP_BUILD_TOOLS_VERSION=27.0.1
PROP_APP_ABI=armeabi-v7a:x86
PROP_BUILD_TYPE=ndk-build

I have the same issue, it appeared after I have upgraded to the latest sdkbox version.

I have upgraded SdkBox 2.4.0.0 up to 2.4.1.1 version, and now see a lot of UnsatisfiedLinkError’s on google play that are related to SDKBox.init call. I’ve never saw such a sdkbox errors before this update.

  1. can you share your app’s google play link,
  2. can you share your ndk compile config.

NDK: r16b

APP_PLATFORM := android-15
APP_ABI := armeabi-v7a

PROP_COMPILE_SDK_VERSION=26
PROP_MIN_SDK_VERSION=15
PROP_TARGET_SDK_VERSION=26
PROP_BUILD_TOOLS_VERSION=27.0.3

Game on Google Play

Copyright © 2016-2018 SDKBOX Inc. v1.0.2.0
installed packages:
v2.4.1.1 admob
v2.4.1.1 iap
v2.4.1.1 facebook
v2.4.1.1 googleplayservices
v2.4.1.1 review

Additionally I have another new issue I think it is related to review plugin:

android.view.WindowManager$BadTokenException
org.codechimp.apprater.AppRater.showRateAlertDialog

  android.view.WindowManager$BadTokenException: 
  at android.view.ViewRootImpl.setView (ViewRootImpl.java:793)
  at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:356)
  at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:93)
  at android.app.Dialog.show (Dialog.java:330)
  at org.codechimp.apprater.AppRater.showRateAlertDialog (AppRater.java:394)
  at org.codechimp.apprater.AppRater.tryShowDialog (AppRater.java:225)
  at com.sdkbox.plugin.PluginReview$1.run (PluginReview.java:58)
  at android.os.Handler.handleCallback (Handler.java:790)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6626)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:811)

confirm bug with sdkbox 2.4.1.1 java.lang.UnsatisfiedLinkError: at com.sdkbox.plugin.SDKBox.nativeInit (Native Method) on devices:

  • Samsung Galaxy J5 Prime (on5xelte), Android 8.0
  • Samsung Galaxy S6 (zeroflte), Android 7.0
  • Samsung Galaxy S8 (dreamlte), Android 8.0
  • Samsung Galaxy J7 (j7y17lte), Android 7.0
  • Xiaomi Redmi Note 5A (ugg), Android 7.1
  • Xiaomi Mi A1 (tissot_sprout), Android 8.1

We have Xiaomi Mi A1 on 8.1 but can’t reproduce this bug. We will add crashlytics to onLoadNativeLibraries

did you get this excepiton when app launch? @angelvet

I didn’t have this crash personally. I have a lot of them on google play console. I assume it has happening when user closes review dialog not by tapping any of review dialog buttons but maybe hardware back button. Also I’m displaying review dialog only after some in-game events, never at app launch.