react-native: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
App crash on Android integration with existing apps.
Crash log.
E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
2019-07-07 18:59:27.223 10045-10073/com.mihir.reactApp E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.mihir.reactApp, PID: 10045
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:19)
at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
at java.lang.Thread.run(Thread.java:764)
React Native version:
System: OS: macOS 10.14.5 CPU: (8) x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz Memory: 1.19 GB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 12.5.0 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: Android SDK: API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29 Build Tools: 23.0.1, 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.0, 29.0.0 System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: /undefined - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: ^0.60.0 => 0.60.0 npmGlobalPackages: react-native-cli: 2.0.1
Steps To Reproduce
- Create a new Android app which uses AndroidX.
- Add react-native to Android application as, implementation ‘com.facebook.react:react-native:+’
- Run app on any android device/emulator.
Sample project on GitHub which reproduces crash.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 122
- Comments: 187 (19 by maintainers)
Commits related to this issue
- React Native sync for revisions 54f297a...ab075a2 Summary: This sync includes the following changes: - **[ab075a232](https://github.com/facebook/react/commit/ab075a232 )**: Do not unmount layout effe... — committed to facebook/react-native by sammy-SC 2 years ago
- React Native sync for revisions 54f297a...ab075a2 Summary: This sync includes the following changes: - **[ab075a232](https://github.com/facebook/react/commit/ab075a232 )**: Do not unmount layout effe... — committed to OlimpiaZurek/react-native by sammy-SC 2 years ago
hi @mhrpatel12 ,
I’m having same issue. You can follow this link.
Add following code in build.gradle
in dependency add in following
View the upgrade guide https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0
You’re likely missing the step android/build.gradle
it is work for me, thanks
For me worked that fix with
in build.gradle
What fixed it for us was upgrading the SOLoader.
In
android/app/build.gradle
:Still no working,
check your android/app/build.gradle
Tried every single solution in the thread and it doesn’t work. I vent from RN 0.59 to 0.62… Same error. Every minor update is a breaking update. It really starts to bother us.
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 :This resolved the issue for me, hope it can help a few of you.
Best regards.
I hit this issue today when we downgraded from 0.68 to 0.67.x for RN.
it appears the hermes-<release and debug>.aar both depend on libjscexecutor.so … probably because hermes didnt have full feature parity and they relied on some parts of the previous runtime to do the job… I donno exactly
When building the debug version and hermes in enabled, libjscexecutor.so is packaged with the APK. When building the release package it is removed.
After looking at the /node_modules/react-native/build.gradle, I seen there was a flag to leave “un-needed” libraries. Setting
I can see that libjscexecutor.so is in the resulting apk and the app works correctly!!!
I further looked at RN 0.68.X and seen it is compiled with hermes 0.11.0, looking at a fresh app’s apk I see no “libjscexecutor.so” is packaged in the APK and the app works. Also, the dependency in hermes-<debug and release> has been removed.
I hope this help some poor soul out there.
Here is how I fix it.
Basically I initialised new Android project and compared all the changes in the main file (build.gradle). Doing these changes made my app run again.
I upgraded from RN 59.(Some Version) to 62.2
In gradle.properties, add following
FLIPPER_VERSION=0.33.1
In
MainApplication.java
add following importimport com.facebook.react.ReactInstanceManager;
in
build.gradle
at android/app/build.gradle add following insideandroid {
And following in dependencies
If you
BasePackageList.java
file inandroid/app/src/main/java/com/{projectName)/generated/BasePackageList.java
then delete this file.This should fix
Basically I initialised new Android project and compared all the changes in the main file (build.gradle). Doing these changes made my app run again.
Also, Maybe they had some guide on how to update to RN 0.60+ which I never went through (dependent bot updated my project)
I think if peoples sure that config for android correct. So, check your android/app/build.gradle
If have two lines after:
~Remove it resolved my problem. So hope it will help all you guys~
Replace your
packagingOptions
with values from default RN configHere is how I managed to solve the problem.
rm -rf node_modules
.android/app/build
folder.yarn install
(from the root of your project)npx react-native run-android
Updating the SoLoader worked for me too, but after a deeper dive I think this is just a caching issue. Try:
@mhrpatel12 Have you made sure
$rootDir/../node_modules/jsc-android/dist
is a valid path in your project? If not, you need to do annpm install --save jsc-android
@cortinico I also have the same error I’m using expo 49 and react-native 0.72.3
Firebase crashlytics detected a similar crash on a OnePlus8 Pro. The app was on RN 0.70.4.
Below was the error log captured.
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.wagesplitter.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:896) at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:725) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:649) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:629) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577) 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:393) at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:343) at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:96) at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42) at com.wagesplitter.app.MainApplication.onCreate(MainApplication.java:66) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1194) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6756) at android.app.ActivityThread.access$1300(ActivityThread.java:238) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7701) 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)
A note to anyone still struggling, and to reiterate what others have said above: That error you get in logcat…
couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
… is not a fatal error. It has no effect on anything. It doesn’t cause a crash/freeze.
In our case (like many others above) it was our javascript that was causing our app to freeze during startup. Why? The production build of our app (RN 0.63.3, hermes 0.5.1) had obfuscated js which was completely borking hermes. Logcat was giving us no clues and there was no crash.
Solution that worked for me, In
app/build.gradle
changeimplementation "com.facebook.react:react-native:0.66.3"
toHi @ilyagru, @Yandamuri,
Did you guy solve the issue on RN 0.68.2. I’m facing the same issue when trying to use Dexguard(with either Hermes enable or not).
Even when the libjscexecutor.so is found but still causing the running time error.
Any helps please? Really appreciate that. Thanks
@Villar74 thanks its work for me.
Facing the same issue in an Expo project, any solution for this ?
cd android && ./gradlew clean
I facing the same issue.
i did this process but still coming error java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libjscexecutor.so caused by: couldn’t find DSO to load: libjsc.so this almost killing me…
Trying to upgrade RN from 0.59.9 to 0.62.2
@nicsachin For me, it’s still not working. Did you tried running the sample project I’ve shared?
I solved it this way, friends who encounter this problem can try: The first: You need to change the app/gradle
The second: You need to change the principal’s gradle
The third: You need to add the next at setting gradle
from:https://stackoverflow.com/questions/59604146/react-native-compile-bundle-with-android-studio
My build.gradle (app)
apply plugin: “com.android.application”
import com.android.build.OutputFile
/**
react-native bundle
with the correct arguments during the Android buildapply from: "../../node_modules/react-native/react.gradle"
line.project.ext.react = [ entryFile: “index.js”, enableHermes: false, // clean and rebuild if changing bundleInStaging: true, // Add this bundleInInternalTest: true, // Add this bundleInRelease: true, hermesCommand: “…/…/node_modules/hermes-engine/%OS-BIN%/hermes”, ]
apply from: “…/…/node_modules/react-native/react.gradle”
/**
/**
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
andString.localeCompare
that/**
android { compileSdkVersion rootProject.ext.compileSdkVersion
// //pickFirst ‘/libhermes-inspector.so’ //pickFirst '/libjscexecutor.so’ //pickFirst ‘/lib-main/libhermes-inspector.so’ // exclude '/libhermes-inspector.so’ exclude ‘/libjscexecutor.so’ // exclude “lib/arm64-v8a/libgnustl_shared.so” // exclude '/lib/mips64/’ // exclude ‘/lib/arm64-v8a/’ // exclude '/lib/x86_64/’
}
dependencies { implementation fileTree(dir: “libs”, include: [“*.jar”]) //noinspection GradleDynamicVersion implementation ‘com.facebook.soloader:soloader:0.9.0+’
}
// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into ‘libs’ }
apply from: file(“…/…/node_modules/@react-native-community/cli-platform-android/native_modules.gradle”); applyNativeModulesAppBuildGradle(project)
Did you add below in
android/app/build.gradle
?how to fix this stupid issue wtf ?
@mhrpatel12 check out your file though. https://github.com/mhrpatel12/ReactApplication/blob/master/android/build.gradle
You’re missing pieces
me too I ++
I have the same problem but i am using Hermes. The app is working.
my build.gradle
Appart from this it is the same basic build.gradle as the RN 0.63 template
Adding the jscFlavor implementation when using Hermes works but I assume it will package a useless lib in the bundle
Having the same issue with the same specs
I am also facing this issue in an expo project. App runs fine in expo go. The APK built using EAS installs in a device but crashes when I opened it. Is there any permanent fix for this issue?
Adding
implementation 'com.facebook.soloader:soloader:0.10.5+'
independencies
of android/app/build.gradle fixed the issue for me.Hermes: disabled React Native: 0.62.2
For the folks upgrading to RN 0.70, we need to replace this
if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") implementation jscFlavor // It's important }
with
if (enableHermes) { //noinspection GradleDynamicVersion implementation("com.facebook.react:hermes-engine:+") { // From node_modules exclude group:'com.facebook.fbjni' } }
This only works in debug mode and not in release mode. Turns out, my build types were causing the issue. I was attempting to build a develop or staging mode with debuggable set to false. Any non-debuggable versions need to have the name “release” as part of it, so I could either replace my build variant names from develop to developRelease or staging to stagingRelease.
Instead, in project.ext.react, I had to add this since we have develop and staging versions that are non-debuggable.
deleteDebugFilesForVariant: { def variant -> variant.name.toLowerCase().contains("release") || variant.name.toLowerCase().contains("staging") || variant.name.toLowerCase().contains("develop") }
The react native module’s react.gradle file has this which caused the issue:
def deleteDebugFilesForVariant = config.deleteDebugFilesForVariant ?: { def variant -> variant.name.toLowerCase().contains("release") }
That’s not correct. Hermes and JSC are completely independent. On console, you will see that the app tries to load JSC first, and fallbacks to Hermes if not found. That’s the reason why you see a failed to load
libjsc.so
message.Your app might crash for anothe reason and you’re probably blaming this line instead.
Also a heads up here:
That might solve some of the issues, but you’re disabling the cleanup of the APK from unused .so resulting in a bigger app size at the end of the day.
@Yandamuri @MaxJadav
We also noticed the same crash from this specific device OnePlus8Pro Android 11. (and we also use aab). The RN version is 0.63.4 + Hermes. Other devices doesn’t have this issue.
Getting this crash in specific device OnePlus8Pro Android 11. Generating aab file. Any one have quick solution?
_Fatal Exception: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libjscexecutor.so caused by: couldn’t find DSO to load: libfb.so caused by: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.disctopia.android/lib-3/libc++shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0
The strategy for using JSC or Hermes is not very sophisticated, because Java lacks conditional compilation. The code for RN 0.63.0 is here: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java#L292-L329 and hasn’t changed since RN 0.63.
Basically, it tries to load JSC, and if it fails, it tries to load hermes. So the behavior you are seeing is intentional.
The problem is that gradle doesn’t automatically clean up after itself very well. So you sometimes end up with an apk which contains part of jsc and part of hermes, or neither of them, and this is unstable.
The build.gradle file says you should clean and rebuild if you enable or disable hermes: https://github.com/facebook/react-native/blob/master/template/android/app/build.gradle#L81
So make sure you run
./gradlew clean
if you are experiencing weird issues. I have also seen circumstances where the apk on the device needs to be completely removed, and then reinstalled fresh.if you have this error it means that you have a jsc aar missing, you can find it in node_modules\jsc-android\dist
Make sure it is included in your dependencies
You are probably missing some dependencies
Still the same issue from the Firebase crash on OnePlus 8, any ideas?
+1
Thanks!@Yandamuri
Add the following configuration,libjscexecutor.so is not missing in apk.
But, “libjsc.so” is still missing, I guess hermes still depends on jsc,So I’m still relying on jsc while enabling the hermes engine, here is my gradle configuration. Solved the crash problem in release mode.
Step1
Step2 Replace “android-jsc” to “android-jsc-intl”
Step3
@Yandamuri It’s not smooth 😅 , migrating from 67 to 68 I have this issue with SoLoader, so now I’m trying to see if upgrading from 67 straight to 69 would fix the issue. I can report back here once I finish 👍🏻
I have the same problem, I solved it, just try update okhttp version:
implementation("com.squareup.okhttp3:okhttp:4.9.1")
Android support version : “28.0.0”
I’m having the same error ONLY when I build
aab
orapk
while working just fine in direct build and installit seems this could be caused by many different things… i didn’t have
bundleInRelease: true
inproject.ext.react
😿Finally I was able to solve, as mentioned in a post above, my issue wasn’t directly link to the error:
couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
It was on the javascript side, what I did is comment everything in my
App.tsx
until the App could start without crashing and then, comment/uncomment to narrow down the culprit causing my app to crash on Android. The difficulty is that there are no logs appearing concerning that crash either in metro / flipper / crashlytics.Good luck.
All of a sudden my app stopped running again even with gradle plugin at 3.6.0! I didn’t change anything in my android build settings. I’m out of leads here, it just stopped suddenly with apparently no change. Is this some sort of non-deterministic build issue on some platforms?
Why is RN trying to load libjscexecutor.so when we’re using hermes?
edit: doh! The issue was unrelated. The error message about missing libjsc is expected and does not cause any issues. You can see for yourself here https://github.com/facebook/react-native/blob/60e00d9d96d7b186c1d4c1542caddc1b74eeb3da/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java#L291.
My issue was that Android Studio inserted
import com.facebook.react.BuildConfig;
into my MainApplication.java which doesn’t cause any build failures but it does prevent the app from connecting to metro in debug mode and crashes it. Simply removing that line did the trick.me too
Did you guys manage to solve this crash for OnePlus8Pro Android 11? I’m facing the same.
Hi,
I fixed this issue by settings
multiDexEnabled
tofalse
, since I don’t require it (yet). FYI multi DEX is useful for specific cases, you might no need it.is there any update for this issue? I tried all the ideas above and still get the same crash unfortunately
@tomtargosz How did you do that? Using resolutions to force the
hermes-engine
to 0.10.0?I’m facing the same error at 0.67.3
It’s appear that cause of this error was a missing dependency implementation that broke flipper implementation.
implementation "io.grpc:grpc-okhttp:1.32.2"
solves my problem.in
/android/app/build.gradle
:View build.gradlew
This was true for me. Scanning the logs deeper revealed it was actually a problem with my installation of Reanimated V2, and that issue was solved with this solution.
@nicolasbraun This fixed it for me too after upgrading to RN 0.64.0. Did you find any different solution to avoid the duplicate lib?
It’s works with
(cd android && ./gradlew clean)
on Mac OSThanks
Also came up with a solution, had to pin some versions.
My
build.gradle
:My
package.json
:E.g.:
hermes-engine
v6 cannot be used forreact-native
0.63. It is intended for 0.64. Andmetro-config
has to be 0.58, because that’s the one that thereact-native
package uses as well.Don’t forget to clean and rebuild after changing that:
@SudoPlz I’ve changed my
targetSdkVersion
to 28 and cleaned the build folder but I’m still getting the error…For us even though we were getting that same error in our crash reports, it wasn’t the real reason for the crash. The real reason was execute only memory which is an API 29 feature - so looks like some react native c++ lib (probably the Hermes aar) doesn’t support that feature. The workaround was to down grade the targetSdkVersion to API 28 and the crashes stopped!
Opened a ticket here https://github.com/facebook/react-native/issues/29517
I am able to fix it by adding the following dependencies to app/build.gradle
and adding the version in android/gradle.properties FLIPPER_VERSION=0.33.1
@yurykorzun
How?
@crispywong thank you, it’s working now. Still, I’m confused what’s going on, why I’m able to run perfectly on version 0.59.10 without all these changes?
I’m not migrating from .59 to .60. This issue happens even on a brand new android project which uses AndroidX. You can see for yourself on sample project I created.
I’m still having the same issue with RN 0.72.6 and expo 49.0
Thanks @rossparachute and @Linuhusainnk
Updating react native version at this point is too much work for me. But I am able to run it once updated on v0.69.7
Used this as ref - https://github.com/facebook/react-native/issues/35210
why are they not answering, i am facing this issue too
Reopen this issue please
Still the same issue from the Firebase crash on OnePlus 8, any ideas?
omg. i wanna hug you. thank you. this is the only thing that worked for me
Worked for me, thanks!
I have this issue
couldn't find DSO to load: libjscexecutor.so
and I even have Hermes enabled.For those still facing this issue, since RN 0.67 I encountered it when creating a new build variant for android. If you have hermes enabled, you need to add these lines in
android/app/build.gradle
(for a variant namedbeta
) :as mentioned in https://github.com/facebook/react-native/pull/32281 (see also https://github.com/facebook/react-native/issues/33177)
I’m facing this problem only for Android 11
Hello, I have this error when I want to launch my app it crashes directly. It’s been several weeks since I have problems with Hermes. Can someone help me please
SoLoader: couldn’t find DSO to load: libjscexecutor.so result: 0 2020-11-04 11:29:23.838 4282-4599/com.test E/SoLoader: couldn’t find DSO to load: libhermes.so result: 0 2020-11-04 11:29:23.852 4282-4599/com.test E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.test, PID: 4282 java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libhermes.so result: 0 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:825) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:673) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:611) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:559) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1017) at java.lang.Thread.run(Thread.java:929)
@Daavidaviid glad you figured it out! If you don’t mind sharing, can you say what JS code was causing the crash?
@mrousavy Check your android gradle plugin version. For me after changing
targetSdkVersion
to 28 and soloader to 0.9.0 this workedbut this failed
I was attempting to use gradle plugin 4.1.0 per the instructions from the play console beta to include debug symbols in the app but clearly it’s different enough from 3.6 that it causes issues.