Android with RN 0.67.3 crashes when running custom build type with hermes enabled
See original GitHub issueDescription
When you create new RN project running on 0.67.3 and add a custom build type that inherits from release and launch the app it crashes. Does not crash in debug and does not crash when launching the app in release build type (pre-defined).
Version
0.67.3
Output of npx react-native info
System:
OS: Windows 10 10.0.22000
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 25.48 GB / 47.76 GB
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.1.3 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8139111
Visual Studio: 17.0.32014.148 (Visual Studio Community 2022)
Languages:
Java: 17.0.1 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.3 => 0.67.3
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
- npx react-native init AwesomeProject
- enable hermes engine
- in app/build.gradle define custom build type like this:
staging {
initWith release
signingConfig signingConfigs.debug
applicationIdSuffix ".staging"
matchingFallbacks = ['release']
}
and enable hermes:
project.ext.react = [
enableHermes: true, // clean and rebuild if changing
bundleInStaging: true, //include JS bundle in staging builds
devDisabledInStaging: true //disable DEV mode in staging builds
]
- Build and try to run the app in staging build type
Snack, code example, screenshot, or link to a repository
Crash in Android Studio:
2022-02-25 01:00:27.863 32152-32152/? E/SoLoader: couldn't find DSO to load: libjscexecutor.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject.staging/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
Native lib dir: /data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64
result: 0
2022-02-25 01:00:27.878 21175-21175/? E/ssioncontrolle: Unknown bits set in runtime_flags: 0x800000
2022-02-25 01:00:27.882 21175-21175/? E/ssioncontrolle: Not starting debugger since process cannot load the jdwp agent.
2022-02-25 01:00:27.891 32152-32152/? E/SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZN8facebook6hermes13HermesRuntime11getDebuggerEv" referenced by "/data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64/libhermes-executor-common-debug.so"... result: 0
2022-02-25 01:00:27.897 19539-19576/? E/ExternalAccountType: Unsupported attribute readOnly
2022-02-25 01:00:27.908 32152-32152/? E/SoLoader: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject.staging/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
Native lib dir: /data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64
result: 0
2022-02-25 01:00:27.911 32152-32152/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.awesomeproject.staging, PID: 32152
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject.staging/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
Native lib dir: /data/app/~~JSLNwb7IlKnxWGWDPiIrbQ==/com.awesomeproject.staging-N3SYkVVNGuwgJimlsN-CtQ==/lib/arm64
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.react.jscexecutor.JSCExecutor.loadLibrary(JSCExecutor.java:24)
at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:20)
at com.facebook.react.jscexecutor.JSCExecutor.loadLibrary(Unknown Source:0)
at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:352)
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:319)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:95)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
at com.awesomeproject.MainApplication.onCreate(MainApplication.java:47)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1208)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6986)
at android.app.ActivityThread.access$1700(ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:17 (2 by maintainers)
Top Results From Across the Web
React Native Android production build crashes on physical ...
It works fine on dev mode (launched with npm run android:dev ). According to RN's doc, the command cd android && .
Read more >Using Hermes - React Native
Edit your android/app/gradle.properties file and make sure hermesEnabled is true: # Use this property to enable or disable the Hermes JS engine.
Read more >cannot read properties of undefined (reading 'configurations') react ...
this fixes the crash due to userConfig being empty (not sure if it's a bug or bad config). then run react-native run-android normally....
Read more >Fixing React-Native android release build - wesionaryTEAM
Fixing React-Native android release build Android release build crashes on launch but works fine on a development mode. couldn't find DSO to load: ......
Read more >React Native Firebase
Welcome to React Native Firebase! To get started, you must first setup a Firebase project and install the "app" module.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I found the issue. It got broken because of this commit:
https://github.com/facebook/react-native/commit/91adb761cf1583598d4d63ce879fd7e0f4ae793c
so in order for this to work you need to name your build variants including a word “release”. What I tried to do then is this:
rename build variant
rename settings to align with the new name:
and
But I still think this is breaking change and probably not the right way to do it. This requires us to change not only name of build variants but also all references to it like CI scripts.
Thanks ! Got it resolved by adding these lines in
android/app/build.gradle
(my variant name’sbeta
) :as mentioned in https://github.com/facebook/react-native/pull/32281