[0.60.3] App crash on startup when enabling Hermes (enableHermes: true)
Problem
App is crashing when I enable Hermes in android/app/build.gradle. App is working fine with react-native 0.60.3 with enableHermes: false Error: ` 07-12 08:06:59.097 20330-20330/com.reactnativememoryprofile E/SoLoader: couldn't find DSO to load: libjscexecutor.so 07-12 08:06:59.123 20330-20345/com.reactnativememoryprofile E/SoLoader: couldn't find DSO to load: libhermes.so 07-12 08:06:59.124 20330-20345/com.reactnativememoryprofile E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.reactnativememoryprofile, PID: 20330 java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so 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.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949) at java.lang.Thread.run(Thread.java:818) ` React Native version: System: OS: macOS 10.14.5 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 373.31 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.1 - /usr/local/bin/node
Error Output
Error: couldn't find DSO to load: libhermes.so
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix Hermes Library Loading Issue on Android Startup
The app crashes on startup with Hermes enabled due to missing native libraries (libhermes.so and libjscexecutor.so). This typically occurs when the Hermes engine is not properly integrated into the project, often due to misconfiguration in the Gradle files or missing dependencies.
Awaiting Verification
Be the first to verify this fix
- 1
Update build.gradle for Hermes
Ensure that the Hermes dependency is correctly specified in your android/app/build.gradle file. Add the necessary Hermes dependencies if they are missing.
groovyproject.ext.react = [ enableHermes: true, // Add this line if not present ] - 2
Check for Hermes Installation
Verify that Hermes is installed in your project. Run the following command to ensure Hermes is included in your dependencies.
bashnpm install hermes-engine --save - 3
Clean and Rebuild the Project
After making changes to the build.gradle file, clean the project to remove any cached builds. Then rebuild the project to ensure all dependencies are correctly linked.
bash./gradlew clean && ./gradlew assembleRelease - 4
Update React Native Version
If the issue persists, consider updating React Native to a newer version that may have better support for Hermes. Check the official React Native documentation for compatibility.
bashnpm install react-native@latest - 5
Test on Physical Device
Run the application on a physical device or emulator to verify that Hermes is functioning correctly and the app does not crash on startup.
bashreact-native run-android
Validation
Confirm that the app starts without crashing when Hermes is enabled. Check the logs for any errors related to Hermes or library loading. If the app runs smoothly, the fix is successful.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep