Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Couldn't find DSO to load crash in release build and hermes is enabled #33120

Closed
urbanclap-admin opened this issue Feb 16, 2022 · 60 comments
Labels
Platform: Android Android applications.

Comments

@urbanclap-admin
Copy link

Description

Hermes is enabled with following packaging options in android.

packagingOptions {
if (enableHermes) {
// For Hermes, delete all the libjsc* files
exclude "/libjsc*.so"
if (taskName.contains("Release")) {
// Reduce size by deleting the debugger/inspector
exclude '
/libhermes-inspector.so'
exclude '/libhermes-executor-debug.so'
} else {
// Release libs take precedence and must be removed
// to allow debugging
exclude '
/libhermes-executor-release.so'
}
} else {
// For JSC, delete all the libhermes* files
exclude "**/libhermes*.so"
}
}

Getting this crash on release build.

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so caused by: couldn't find DSO to load: libreactnativejni.so caused by: ELF file truncated result: 0 result: 0
   at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
   at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
   at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654)
   at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634)
   at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582)
   at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:25)
   at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
   at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
   at java.lang.Thread.run(Thread.java:923)

Version

0.66.0

Output of npx react-native info

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so caused by: couldn't find DSO to load: libreactnativejni.so caused by: ELF file truncated result: 0 result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:25)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Steps to reproduce

N/A

Snack, code example, screenshot, or link to a repository

No response

@cortinico
Copy link
Contributor

Hermes is enabled with following packaging options in android.

You can't use if (taskName.contains("Release")) condition inside the packagingOption. The react.gradle script is already taking care of this for you. You don't need this extra handling.

@urbanclap-admin
Copy link
Author

Shall i remove the packagingOptions itself. Previously it was introduced to reduce the app size.

@1natsu172
Copy link

1natsu172 commented Feb 22, 2022

@cortinico

This is also happening in my Android environment.
I'm working on bumping from 0.63.2 to 0.67.1, and the application in the release build crashes immediately before the splash screen.

Multiple logs of couldn't find DSO to load can be seen in the adb log output. An excerpt is below.

Logs 02-22 18:00:04.412 9890 9890 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so 02-22 21:42:28.406 3548 3548 E SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found result: 0 02-22 21:48:22.995 4603 4603 E SoLoader: couldn't find DSO to load: libjscexecutor.so 02-22 21:48:23.033 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 02-22 21:48:23.034 4603 4603 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 02-22 21:48:23.034 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-executor-common-debug.so caused by: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 result: 0 02-22 21:48:23.034 4603 4603 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-common-debug.so caused by: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 result: 0 02-22 21:48:23.034 4603 4603 W System.err: Caused by: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 02-22 21:48:23.035 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: couldn't find DSO to load: libhermes-executor-common-debug.so caused by: couldn't find DSO to load: libhermes-inspector.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/data/jp.exampleapp.canary/lib-main/libhermes-inspector.so"... result: 0 result: 0 result: 0 02-22 21:48:23.035 4603 4603 E SoLoader: couldn't find DSO to load: libhermes-executor-release.so 02-22 21:48:23.036 4603 4603 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so 02-22 21:48:23.036 4603 4603 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so
npx react-native info

System:
OS: macOS 12.2.1
CPU: (8) arm64 Apple M1 Pro
Memory: 99.73 MB / 16.00 GB
Shell: 3.3.1 - /opt/homebrew/bin/fish
Binaries:
Node: 14.18.2 - ~/.asdf/installs/nodejs/14.18.2/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 6.14.15 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: 2022.01.24.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 29, 30, 32
Build Tools: 28.0.3, 29.0.2, 30.0.2, 32.0.0
System Images: android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7935034
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_312 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.1 => 0.67.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found


#33065, #33079 also looks like a very similar Issue. However, each seems to have a different version of RN. Is there a widespread impact on the release build?

※This problem did not occur in the debug build

@cortinico
Copy link
Contributor

Shall i remove the packagingOptions itself. Previously it was introduced to reduce the app size.

@urbanclap-admin It depends on your setup. Technically you don't need it, but there might be a library that requires it.

couldn't find DSO to load: libjscexecutor.so

@1natsu172 So this looks like a problem in your build. Essentially if you pick JSC as engine, your APK should have libjsc.so and libjscexecutor.so inside it. If they're not there, then you're either misconfiguring your Gradle build or there is a bug in our setup.

If you could provide a reproducer, I could look more closely into it.

@1natsu172
Copy link

@cortinico
Sorry, I can't provide repro as only have private production project. But I found #32928 and knew about the deleteDebugFilesForVariant API. In my environment, deleteDebugFilesForVariant: { true } solved the crash in the release build.

#33177 also seems to have the same report as me, so it seems that the change around #32281 has some effect.

The deleteDebugFilesForVariant API is not documented anywhere and I don't clearly understand what is being cleaned up. Is there an explanation somewhere? regards.

@brunoducattii
Copy link

@cortinico Sorry, I can't provide repro as only have private production project. But I found #32928 and knew about the deleteDebugFilesForVariant API. In my environment, deleteDebugFilesForVariant: { true } solved the crash in the release build.

#33177 also seems to have the same report as me, so it seems that the change around #32281 has some effect.

The deleteDebugFilesForVariant API is not documented anywhere and I don't clearly understand what is being cleaned up. Is there an explanation somewhere? regards.

@1natsu172 where should i insert deleteDebugFilesForVariant: { true }?

Thank you in advance.

@1natsu172
Copy link

@joaotmachado at your app/build.gradle .
ref: #32928 (comment)

@brunoducattii
Copy link

brunoducattii commented Feb 26, 2022

Good news. Solved with this issue: [https://github.com//issues/25537#issuecomment-526562565].

@peterchibunna
Copy link

Hello,
On an M1 Mac, Monterey, the issue persists and prevents release apk from running successfully. This happens whether enableHermes is true or false. or whether deleteDebugFilesForVariant: { false } is included in the proper place.
Happens on react-native 0.67 till 0.68.2

@dehimer
Copy link

dehimer commented Jun 14, 2022

Same story

@cortinico
Copy link
Contributor

Closing as there was no reproducer provided and we can't really look into this issue, without a proper reproducer.

@peterchibunna
Copy link

Hi @cortinico, I'm not sure how closing this issue helps the project. I'm sure a lot of M1 Mac users would be experiencing this issue, maybe or not related to not having Rosetta present. But I have not been successful with a release apk for Android, most likely because I don't need Rosetta. The same source code builds a successfully running release apk when built from an Intel Mac. I've applied a lot of suggestions that are out there. None of them has worked. How do I help you in reproducing this issue?

@cortinico
Copy link
Contributor

How do I help you in reproducing this issue?

If you're still experiencing this problem:

  1. Creata a new project from the React Native Template
  2. Adapt it to make it crash as you wish
  3. Publish it on Github
  4. Open a new issue, mentioning the repro steps + link agains this issue

@felix-lambert
Copy link

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.

Best regards.

This worked for me

@MarkusPettersson98
Copy link

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.
Best regards.

This worked for me

This worked for me as well, thanks!

@AlexandreHauber
Copy link

AlexandreHauber commented Sep 4, 2022

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.
Best regards.

This worked for me

Thanks!
For me, in addition to that, I had to bump react-native-reanimated to 2.10.0.

@felipejh
Copy link

felipejh commented Sep 8, 2022

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.
Best regards.

This worked for me

Thanks! For me, in addition to that, I had to bump react-native-reanimated to 2.10.0.

I already had this, but it still not working.

@AlexandreHauber
Copy link

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.
Best regards.

This worked for me

Thanks! For me, in addition to that, I had to bump react-native-reanimated to 2.10.0.

I already had this, but it still not working.

Don't know if this will help you, but in package.json, besides react-native-animated, I also bumped to the latest version:

  • react-native-gesture-handler (which required some changes on MainActivity.java)
  • react-native-reanimated
  • react-native-render-html
  • react-native-safe-area-context
  • Deleted the "hermes-engine": "0.11.0" entry.

@zhuzheng1991
Copy link

i fix this. you can override getJavaScriptExecutorFactory in your ReactNativeHost if you use hermes,force JSExecutorFactory use hermesExecutorFactory

override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory? {
        HermesExecutor.loadLibrary()
        return HermesExecutorFactory()
}

@Nesh108
Copy link

Nesh108 commented Nov 7, 2022

Found a fix for the issue with hermes:

Change:

implementation("com.facebook.react:hermes-engine:+") { // From node_modules
    exclude group:'com.facebook.fbjni'
}

to:

implementation("com.facebook.react:hermes-engine:" + <YOUR_REACT_NATIVE_VERSION>) { // From node_modules
    exclude group:'com.facebook.fbjni'
}

for example, for mine I used:

implementation("com.facebook.react:hermes-engine:0.69.5") { // From node_modules
    exclude group:'com.facebook.fbjni'
}

@brycnguyen
Copy link

Found a fix for the issue with hermes:

Change:

implementation("com.facebook.react:hermes-engine:+") { // From node_modules
    exclude group:'com.facebook.fbjni'
}

to:

implementation("com.facebook.react:hermes-engine:" + <YOUR_REACT_NATIVE_VERSION>) { // From node_modules
    exclude group:'com.facebook.fbjni'
}

for example, for mine I used:

implementation("com.facebook.react:hermes-engine:0.69.5") { // From node_modules
    exclude group:'com.facebook.fbjni'
}

This works for me too, but would like to understand why

@Nesh108
Copy link

Nesh108 commented Nov 8, 2022

@brycnguyen read here: #35210

@mklb
Copy link

mklb commented Nov 8, 2022

The only thing that worked for me was disabling Hermes in app/build.gradle

project.ext.react = [
    enableHermes: false,  // clean and rebuild if changing
]

@brycnguyen
Copy link

@Nesh108 Thanks! that's helpful. Looks like the issue was resolved in the patch via react-native 0.69.7.

I tried out that version and it works, however I use Expo so the pinned version is 0.69.6 so I could not simply use that version. I had to make a custom expo config plugin and instead made the change in project build gradle:

allprojects {

    afterEvaluate {
        configurations.all {
            resolutionStrategy {
                force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
                force "com.facebook.react:hermes-engine:" + REACT_NATIVE_VERSION
            }
        }
    }

@garkuwa
Copy link

garkuwa commented Nov 9, 2022

please refer to the following comment to sort this out #33177 (comment). Most likely, you have custom build variants, so you need to configure deleteDebugFilesForVariant and hermesFlagsForVariant to help hermes pick up your variants. Make sure you use the same names as in your build variants (qa, beta, etc)

@levepic
Copy link

levepic commented Dec 21, 2022

I have the same issue on RN 70.6

@shiraz-ahmed-01
Copy link

From here: expo/expo#17450

I was using expo... This worked for me:

android{
   ...
   packagingOptions {
      jniLibs.useLegacyPackaging = true
   }
   ...
  }

If it didn't work, check the link... There are other workarounds as well.

Was upgrading from and older version of react native + expo modules to latest 0.70.5...this fixed the issue for me...thanks man

@kunuit
Copy link

kunuit commented Jan 15, 2023

@cortinico Sorry, I can't provide repro as only have private production project. But I found #32928 and knew about the deleteDebugFilesForVariant API. In my environment, deleteDebugFilesForVariant: { true } solved the crash in the release build.

#33177 also seems to have the same report as me, so it seems that the change around #32281 has some effect.

The deleteDebugFilesForVariant API is not documented anywhere and I don't clearly understand what is being cleaned up. Is there an explanation somewhere? regards.

=> so beatifulllll, love you

@pedrocolon93
Copy link

pedrocolon93 commented Apr 1, 2023

Edit: Sorry for the repost, I did not see the comment above!
For anyone using expo...

try to add this to app/build.gradle

android{
...
packagingOptions {
     jniLibs.useLegacyPackaging = true
}
...
}

Taken from:
expo/expo#17450

@TVGSOFT
Copy link

TVGSOFT commented Apr 21, 2023

This bug still happens in some devices:

  • OnePlus8Pro (Android 11)
  • Honor TFY-AN00 (Android 12)
  • Vivo S15e (Android 11)

Version:
"expo": "~48.0.11",
"install-expo-modules": "^0.5.1",
"react-native": "0.71.6",

Crash 1:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.example.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:26)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:24)
       at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:369)
       at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
       at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
       at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:32)
       at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
       at com.example.app.MainApplication.onCreate(MainApplication.java:66)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1194)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6735)
       at android.app.ActivityThread.access$1300(ActivityThread.java:239)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1915)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Crash 2:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libreact_render_runtimescheduler.so caused by: couldn't find DSO to load: libreact_render_core.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.example.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
       at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:34)
       at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:17)
       at com.facebook.react.bridge.Arguments.createMap(Arguments.java:159)
       at expo.modules.updates.UpdatesController$start$1.onBackgroundUpdateFinished(UpdatesController.kt:303)
       at expo.modules.updates.loader.LoaderTask$launchRemoteUpdateInBackground$1$1.onFailure(LoaderTask.kt:301)
       at expo.modules.updates.loader.Loader.finishWithError(Loader.kt:150)
       at expo.modules.updates.loader.Loader.access$finishWithError(Loader.kt:25)
       at expo.modules.updates.loader.Loader$start$1.onFailure(Loader.kt:102)
       at expo.modules.updates.loader.FileDownloader$downloadManifest$1.onResponse(FileDownloader.kt:310)
       at expo.modules.updates.loader.FileDownloader$downloadData$1.onResponse(FileDownloader.kt:393)
       at com.google.firebase.perf.network.InstrumentOkHttpEnqueueCallback.onResponse(InstrumentOkHttpEnqueueCallback.java:71)
       at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

@hungvu193
Copy link

If you're using ProGuard so you need to add the following rule to android/app/proguard-rules.pro:

-keep class com.facebook.jni.** { *; }

This is mentioned in Breaking change of v0.62.0 changelog. https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#breaking
(https://stackoverflow.com/questions/60927048/react-native-app-release-build-crashes-on-start-works-fine-in-debug-why)

@ucheNkadiCode
Copy link

@TVGSOFT did you ever find a way to fix those crashes on OnePlus8 and those other devices? I also am still seeing some of my users get Crashes due to this error.

I am NOT using the Hermes engine and I am NOT using Expo either. but I am using RN 71.6. Any help would be appreciated.

1 similar comment
@ucheNkadiCode
Copy link

@TVGSOFT did you ever find a way to fix those crashes on OnePlus8 and those other devices? I also am still seeing some of my users get Crashes due to this error.

I am NOT using the Hermes engine and I am NOT using Expo either. but I am using RN 71.6. Any help would be appreciated.

@vladimir-vasilev
Copy link

having the same issue, RN 0.71.0 using Hermes and ProGuard ( with -keep class com.facebook.jni.** { *; })
reproduced on OnePlus8Pro, Xiaomi Mi 9X, LG Nexus 5X

@Milutin-P
Copy link

Here too. Very same errors for OnePlus8Pro.
"react-native": "0.71.8" on release build variant.

@ucheNkadiCode
Copy link

ucheNkadiCode commented May 18, 2023

@cortinico could we consider reopening this? This crash has led to plenty of uninstalls for my app. It’s clear that this is affecting users still to this day

@natuanorg
Copy link

Same issue with react native 0.71.6

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/.../lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:343)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:126)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:2)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:31)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:1)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:6)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java)
       at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:36)
       at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:90)
       at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:148)
       at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.java:53)
       at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:9)
       at com.photoenhancer.MainApplication.onCreate(MainApplication.java:22)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1194)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6735)
       at android.app.ActivityThread.access$1300(ActivityThread.java:239)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1915)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@cortinico
Copy link
Contributor

@cortinico could we consider reopening this? This crash has led to plenty of uninstalls for my app. It’s clear that this is affecting users still to this day

This issue is a duplicate of #37336 and #37404 and others.
I'm happy to reopen as soon as we get a reproducer that we can investigate on.
Sadly just stacktraces are not enough at this stage.

@waleedshkt
Copy link

waleedshkt commented Jun 9, 2023

SOLVED

This issue took a good chunk of my day. I tested almost all the solutions proposed.

But ultimately, the solutions provided here worked!

@narayanchoudhary
Copy link

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.
Best regards.

This worked for me

How do I do that in an Expo app

@sergey-hippo
Copy link

@cortinico

I'm happy to reopen as soon as we get a reproducer that we can investigate on.
Sadly just stacktraces are not enough at this stage.

What data they should collect then? Please elaborate.
I think adb bugreport might be too much for most people, because it includes FS dump.
Also, if you need to know some internal state of RN or SoLoader, maybe you could provide a patch with extra logs?

@cortinico
Copy link
Contributor

What data they should collect then? Please elaborate.

@sergey-hippo I would need a project created from this template:
https://github.com/react-native-community/reproducer-react-native

That I can build locally, and where the app crashes consistently with the error message you're reprorting about.

@sergey-hippo
Copy link

@cortinico sounds good, thanks!

One question though: what if we have an issue that's only reproducible on certain devices, like facebook/SoLoader#59?

@cortinico
Copy link
Contributor

One question though: what if we have an issue that's only reproducible on certain devices, like facebook/SoLoader#59?

That makes things harder as we'll have to find that specific device to potentially fix the issue.

@Ssolyanenko
Copy link

Edit: Sorry for the repost, I did not see the comment above! For anyone using expo...

try to add this to app/build.gradle

android{
...
packagingOptions {
     jniLibs.useLegacyPackaging = true
}
...
}

Taken from: expo/expo#17450

you are number 1. Work for me

@Jamal-ReachFirst
Copy link

Firebase crash report

Error:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
	SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-main flags = 1]
	SoSource 1: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-0 flags = 1]
	SoSource 2: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-1 flags = 1]
	SoSource 3: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-2 flags = 1]
	SoSource 4: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-3 flags = 1]
	SoSource 5: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-4 flags = 1]
	SoSource 6: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-5 flags = 1]
	SoSource 7: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-6 flags = 1]
	SoSource 8: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-7 flags = 1]
	SoSource 9: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-8 flags = 1]
	SoSource 10: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-9 flags = 1]
	SoSource 11: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-10 flags = 1]
	SoSource 12: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-11 flags = 1]
	SoSource 13: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-12 flags = 1]
	SoSource 14: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-13 flags = 1]
	SoSource 15: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-14 flags = 1]
	SoSource 16: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-15 flags = 1]
	SoSource 17: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-16 flags = 1]
	SoSource 18: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-17 flags = 1]
	SoSource 19: com.facebook.soloader.ApkSoSource[root = /data/data/com.worktually/lib-18 flags = 1]
	SoSource 20: com.facebook.soloader.ApkSoSourc<truncated: 7430 chars>
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:25)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:19)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
       at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:394)
       at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:344)
       at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:95)
       at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
       at com.worktually.MainApplication.onCreate(MainApplication.java:56)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1194)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6735)
       at android.app.ActivityThread.access$1300(ActivityThread.java:239)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1915)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

I am using cli:

"react": "18.0.0",
"react-native": "0.69.12",

@rmushtaq123
Copy link

One question though: what if we have an issue that's only reproducible on certain devices, like facebook/SoLoader#59?

That makes things harder as we'll have to find that specific device to potentially fix the issue.

I am facing this issue in release build and
below is the detail of the device:
One Plus 8 Pro device

and logs.
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_json.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.northwest.alaskacommercial/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_json.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.northwest.alaskacommercial/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfolly_json.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.northwest.alaskacommercial/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.northwest.alaskacommercial/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.northwest.alaskacommercial/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.northwest.alaskacommercial/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62)
at java.lang.Runtime.load0(Runtime.java:942)
at java.lang.System.load(System.java:1628)
at com.facebook.soloader.SoLoader$1.load(SoLoader.java:529)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:110)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:812)
at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:177)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:103)
at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:570)
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1066)
at java.lang.Thread.run(Thread.java:923)

Firebase-Messaging-Init:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1120)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:849)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.1.0:2)
at java.lang.Thread.run(Thread.java:923)

pool-2-thread-1:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)

GmsDynamite:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:442)
at java.lang.Object.wait(Object.java:568)
at com.google.android.gms.dynamite.zza.run(com.google.android.gms:play-services-basement@@18.1.0:2)

Firebase-Messaging-Topics-Io:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1120)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:849)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.1.0:2)
at java.lang.Thread.run(Thread.java:923)

com.google.firebase.crashlytics.startup1:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:64)
at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
at java.lang.Thread.run(Thread.java:923)

FinalizerDaemon:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:442)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:190)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:211)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:273)
at java.lang.Daemons$Daemon.run(Daemons.java:139)
at java.lang.Thread.run(Thread.java:923)

OkHttp ConnectionPool:
at java.lang.Object.wait(Object.java)
at com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)

main:
at android.graphics.HardwareRenderer.nSetStopped(HardwareRenderer.java)
at android.graphics.HardwareRenderer.setStopped(HardwareRenderer.java:474)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3868)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3104)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1948)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8177)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7680)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:423)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Okio Watchdog:
at java.lang.Object.wait(Object.java)
at com.android.okhttp.okio.AsyncTimeout.awaitTimeout(AsyncTimeout.java:325)
at com.android.okhttp.okio.AsyncTimeout.access$000(AsyncTimeout.java:42)
at com.android.okhttp.okio.AsyncTimeout$Watchdog.run(AsyncTimeout.java:288)

ReferenceQueueDaemon:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:442)
at java.lang.Object.wait(Object.java:568)
at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:217)
at java.lang.Daemons$Daemon.run(Daemons.java:139)
at java.lang.Thread.run(Thread.java:923)

Crashlytics Exception Handler1:
at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
at java.lang.Thread.getStackTrace(Thread.java:1736)
at java.lang.Thread.getAllStackTraces(Thread.java:1812)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateThreadsList(CrashlyticsReportDataCapture.java:295)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateExecutionData(CrashlyticsReportDataCapture.java:266)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateEventApplicationData(CrashlyticsReportDataCapture.java:216)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.captureEventData(CrashlyticsReportDataCapture.java:102)
at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistEvent(SessionReportingCoordinator.java:274)
at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistFatalEvent(SessionReportingCoordinator.java:127)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:203)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:188)
at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(CrashlyticsBackgroundWorker.java:105)
at com.google.android.gms.tasks.zze.run(com.google.android.gms:play-services-tasks@@18.0.1:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:64)
at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
at java.lang.Thread.run(Thread.java:923)

awaitEvenIfOnMainThread task continuation executor1:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:64)
at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
at java.lang.Thread.run(Thread.java:923)

queued-work-looper:
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.os.HandlerThread.run(HandlerThread.java:67)

ScionFrontendApi:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2109)
at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)

FinalizerWatchdogDaemon:
at java.lang.Thread.sleep(Thread.java)
at java.lang.Thread.sleep_aroundBody0(Thread.java:442)
at java.lang.Thread.sleep_aroundBody1$advice(Thread.java:56)
at java.lang.Thread.sleep(Thread.java:1)
at java.lang.Thread.sleep(Thread.java:358)
at java.lang.Daemons$FinalizerWatchdogDaemon.sleepForNanos(Daemons.java:390)
at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:419)
at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:325)
at java.lang.Daemons$Daemon.run(Daemons.java:139)
at java.lang.Thread.run(Thread.java:923)

Measurement Worker:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:442)
at com.google.android.gms.measurement.internal.zzfu.run(com.google.android.gms:play-services-measurement-impl@@21.1.1:10)

@Filippo39
Copy link

I have the same crash on the following devices:

  • Nexus 5X/5
  • One Plus 8 Pro
  • Samsung Galaxy A3
  • Huawei P40 Lite JNY-LX1

It started showing up after the react-native update to 0.70.8 and expo 47.0.0 with hermes enabled

@michaelxzf
Copy link

WXWorkCapture_16982289227802
hi this happens to libunity.so as well. RN68, unsure if its the same root cause?

@podger
Copy link

podger commented Oct 28, 2023

Same here, happening with Nexus 5 on Android 8.1

react-native 0.72.6

@MariuzM
Copy link

MariuzM commented Oct 29, 2023

I can confirm also happening i raised this here with repo: react-navigation/react-navigation#11673

@franciscomorais
Copy link

I had a similar problem when migrating to react 0.73 which updates gradle to version 8.x.

I don't know if it will help anyone but all contributions are welcome and since it solved my problem, I hope it helps someone. So...

When adding an AAR library, I got this error because the libc++_shared.so dependencies were different.

To check this, I did:
1 - An APK without the AAR dependency
2 - I converted the .apk build to zip and decompressed it.
3 - inside the jni folder, I checked the size of this file.
4 - I kept the entire jni folder separately.

I did the same thing again, now with the dependency that crashes the app. I did the procedure above and noticed that the libc++_shared.so file was different. therefore, to solve the problem:

1 - I created a folder src/jniLibs and placed the following folders inside it: arm64-v8a, armeabi-v7a, x86, x86_64.
2 - I created a libs folder and placed my aar dependencies there.
3 - I copied the respective libc++_shared.so files from the build that worked respectively.
4 - Inside build.gradle I put:

android {
    ...
  
    sourceSets {
      main {
        jniLibs.srcDir 'src/jniLibs'
      }
    }
    ...
}

dependencies {
      implementation files('libs/<module1>.aar')
      ....
      implementation files('libs/<module_x>.aar')
}

If you do pickFirst through packagingOptions, what happens is that it picks the first .so it finds. This way, I force it to load the correct .so and apparently it overrides the files inside the folder.

In my case it worked, but be aware that this can create other problems.

@jorgealdana30
Copy link

#25537 (comment)

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.
Best regards.

This worked for me

For those that are using older versions of RN, this totally works, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications.
Projects
None yet
Development

No branches or pull requests