Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

App crash during launch java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader #471

Closed
SudoPlz opened this issue Jul 28, 2020 · 4 comments

Comments

@SudoPlz
Copy link

SudoPlz commented Jul 28, 2020

Description

Our app crashes during app launch

Issue

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.example.app.android-3vNKvOYNFBjegL3oUY_FYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.app.android-3vNKvOYNFBjegL3oUY_FYw==/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libbugsnag-ndk.so"
     FATAL EXCEPTION: main
Process: com.example.app.android, PID: 10716
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.example.app.android-3vNKvOYNFBjegL3oUY_FYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.app.android-3vNKvOYNFBjegL3oUY_FYw==/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libbugsnag-ndk.so"
  at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
  at java.lang.System.loadLibrary(System.java:1657)
  at com.bugsnag.android.NdkPlugin.<clinit>(NdkPlugin.kt:9)
  at java.lang.Class.classForName(Native Method)
  at java.lang.Class.forName(Class.java:453)
  at java.lang.Class.forName(Class.java:378)
  at com.bugsnag.android.Client.<init>(Client.java:240)
  at com.bugsnag.android.Bugsnag.init(Bugsnag.java:77)
  at com.bugsnag.android.Bugsnag.init(Bugsnag.java:64)
  at com.bugsnag.android.Bugsnag.init(Bugsnag.java:37)
  at com.bugsnag.BugsnagReactNative.start(BugsnagReactNative.java:46)
  at com.example.app.android.MainApplication.onCreate(MainApplication.java:125)
  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)
  at android.app.ActivityThread.-wrap1(Unknown Source:0)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
  at android.os.Handler.dispatchMessage(Handler.java:105)
  at android.os.Looper.loop(Looper.java:164)
  at android.app.ActivityThread.main(ActivityThread.java:6541)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Environment

Library versions:

[email protected] /Users/SudoPlz/Development/Example/mobile
├── [email protected]
└── [email protected]
  • cocoapods version (irellevant but 1.9.3):
  • iOS/Android version(s): Android only (Android 10)
  • simulator/emulator or physical device?: Physical device, Samsung S9
  • debug mode or production?: production

How we set up Bugsnag

MainApplication.java

@Override
    public void onCreate() {
        super.onCreate();
        BugsnagReactNative.start(this);

CrashReporter.js

import { Client, Configuration } from 'bugsnag-react-native';

initCrashReporter(key, codeBundleId) {
    if (this.instance === null) {
      if (key == null) {
        throw new Error(`Crash Reporter should be created with a
         key as the first param. i.e .create(key, reduxStore)`);
      }
      const bugsnagConfig = new Configuration(key);

      // enable session-tracking to provide crash rates between releases
      // https://docs.bugsnag.com/platforms/react-native/#session-tracking
      bugsnagConfig.autoCaptureSessions = true;

      bugsnagConfig.shouldNotify = () => !__DEV__;
      if (codeBundleId) {
        bugsnagConfig.appVersion = codeBundleId;
        bugsnagConfig.codeBundleId = codeBundleId;
      }
      bugsnagConfig.notifyReleaseStages = ['production', 'staging', 'testflight'];

      // create a breadcrumb for all console.logs
      bugsnagConfig.consoleBreadcrumbsEnabled = true;

      const that = this;
      bugsnagConfig.registerBeforeSendCallback(async (report) => {
        const metadata = report.metadata || {};

        if (that && that.mStore) {
          const state = JSON.parse(JSON.stringify(that.mStore.getState()));
          metadata.device = state.device;
          metadata.global = state.global;
          metadata.router = state.router;
          metadata.auth = state.auth;
        }

        if (report.errorClass === 'AcuityError') {
          // if an acuity error, change the severity
          report.severity = 'error';
        }

        const {
          curAppVersion,
          // baseV,
          // codepushV,
          pendingFailed,
          pendingVersion,
          isFirstRunOfRunningCodepushVersion,
        } = await OTAUpdateManager.getAppVersion(CONFIG.VERSION);

        if (metadata.app == null) {
          metadata.app = {};
        }
        // overwrite codeBundleId (version) make sure we use the current version
        if (curAppVersion && metadata.app.codeBundleId !== curAppVersion) {
          metadata.app.tmpVersion = metadata.app.codeBundleId;
          metadata.app.codeBundleId = curAppVersion;
        }

        if (metadata.device == null) {
          metadata.device = {};
        }
        metadata.device.pendingFailed = pendingFailed;
        metadata.device.pendingVersion = pendingVersion;
        metadata.device.isFirstRunOfRunningCodepushVersion = isFirstRunOfRunningCodepushVersion;

        report.metadata = metadata;

        return true; // return false to send no error
      });
      this.instance = new Client(bugsnagConfig);
    }
    return this.instance;
  }
</details>
@steve-nester-uk
Copy link

Hi @SudoPlz this seems like a possible duplicate of: #369 (comment) - can you try the solution mentioned in that thread?

e.g.
These intermittent linkage errors can occur particularly on older versions of Android. Our suggested approach to avoid them would be to preload the SO file with ReLinker:

ReLinker.loadLibrary(this, "bugsnag-ndk");
Bugsnag.init(this);

@steve-nester-uk steve-nester-uk added the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Jul 28, 2020
@SudoPlz
Copy link
Author

SudoPlz commented Jul 28, 2020

This happens on Android 10, is that considered an old version of Android?

@steve-nester-uk
Copy link

steve-nester-uk commented Jul 28, 2020

If you have a minimum SDK level of 23, we didn't think the ReLinker was going to do much to help in that case. However, there is anecdotal evidence that there are still issues with Android loading libraries even on SDK level 23 and above, where ReLinker has fixed this for them. I think it's worth giving ReLinker a go to see if it fixes the issue for you. Could you try this and let us know if it helps?

@SudoPlz
Copy link
Author

SudoPlz commented Jul 29, 2020

Our APK was probably not the right one, we'll investigate and I'll re-open this if needed. Thanks

@SudoPlz SudoPlz closed this as completed Jul 29, 2020
@abigailbramble abigailbramble removed the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Aug 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants