couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
Problem
App crash on Android integration with existing apps. Crash log. [code block] React Native version: System: OS: macOS 10.14.5 CPU: (8) x64 Intel(R) Core(TM) 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 1. Create a new Android app which uses AndroidX. 2. Add react-native to Android application as, implementation 'com.facebook.react:react-native:+' 3. Run app on any android device/emulator. Sample project on GitHub which reproduces crash.
Error Output
Error: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix libjsc.so Not Found Error in React Native Android Integration
The error occurs because the JavaScriptCore library (libjsc.so) is not included in the build configuration for the Android project. This can happen if the project is not properly configured to use the correct version of React Native that supports JavaScriptCore, or if the necessary native libraries are not linked correctly.
Awaiting Verification
Be the first to verify this fix
- 1
Update React Native Version
Ensure that you are using a stable version of React Native that includes the necessary JavaScriptCore libraries. Update your project to use a specific version instead of the '+' wildcard.
groovyimplementation 'com.facebook.react:react-native:0.60.0' - 2
Add JavaScriptCore Dependency
Explicitly add the JavaScriptCore dependency to your build.gradle file to ensure it is included in the build process.
groovyimplementation 'org.webkit:android-jsc:+' - 3
Enable AndroidX Support
Ensure that your project is fully migrated to AndroidX, as React Native 0.60 and above requires AndroidX. Update your gradle.properties file to include the following flags.
propertiesandroid.useAndroidX=true android.enableJetifier=true - 4
Clean and Rebuild Project
After making the changes, clean the project and rebuild it to ensure all dependencies are correctly linked and compiled.
bash./gradlew clean && ./gradlew assembleDebug - 5
Test on Emulator/Device
Run the application on an Android emulator or device to confirm that the issue is resolved and the app does not crash.
bashreact-native run-android
Validation
To confirm the fix worked, check that the app launches without crashing and that the logs do not contain the 'couldn't find DSO to load: libjscexecutor.so' error. Additionally, verify that the JavaScript functionality is working as expected.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep