-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[0.60.3] App crash on startup when enabling Hermes (enableHermes: true) #25601
Comments
The same thing is happening to me, the build is successful, but:
|
you'll need to add
at the top of your
in your dependencies. Should we move those bits of configuration to |
If you have additional build types those will need to be added too, e.g. integrationImplementation files(hermesPath + "hermes-release.aar")
stagingImplementation files(hermesPath + "hermes-release.aar") Because we have a few build types, and apart from debug they should all be in release mode, I also had to add some react.gradle fixes. We have a custom react.gradle so this wasn't too much trouble. Basically changing if (!targetName.toLowerCase().contains("debug")) {
// Can't use ?: since that will also substitute valid empty lists
hermesFlags = config.hermesFlagsRelease
if (hermesFlags == null) hermesFlags = ["-O", "-output-source-map"]
} else {
hermesFlags = config.hermesFlagsDebug
if (hermesFlags == null) hermesFlags = []
} and // Delete the VM related libraries that this build doesn't need.
// The application can manage this manually by setting 'enableVmCleanup: false'
//
// This should really be done by packaging all Hermes releated libs into
// two separate HermesDebug and HermesRelease AARs, but until then we'll
// kludge it by deleting the .so files out of the /transforms/ directory.
def isRelease = !targetName.toLowerCase().contains("debug") Also added a quick fix for #25609 ant.move(
file: jsBundleFile,
tofile: "${jsBundleFile}_temp"
);
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, "${jsBundleFile}_temp", *hermesFlags) |
In my case I saw this crash when:
all while
and
were present. Crash disappears after cleaning the build: |
@dov11 cleaning build doesn't help with that for me |
I, following the guide set enableHermes to true but cant see any global variable named HermesInternal. |
same issue here it builds fine but crashes on start up |
Same issue after setting: Fatal Exception: java.lang.UnsatisfiedLinkError |
couldn't find DSO to load: libhermes.so
|
Same issues |
// @benoitdion where are we initialising the variable jscFlavor?
@benoitdion, If possible then Yes please since I believe user should not be worried about these kind of one time configuration. It would be great if these bits of config move to react.gradle |
Same problem here, using RN 0.60.3. I followed this (https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.3) to upgrade my app from RN 0.59.9 to 0.60.3 and have added all the necessary configs for Android from there. The app runs normally when Hermes is not enabled. However, once Hermes is enabled by following the step here (https://facebook.github.io/react-native/docs/hermes), the app can build, can start up and show the splash screen - but crashes immediately after the splash screen is done. Couldn't find any solution yet. Hope this provides a bit of extra information needed to debug this. |
Same issue here. java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so |
I am also facing the the same issue. Can you please explain this in details if this worked for you to resolve Hermes issue. |
@yjkimjunior @vijayhfs that's a different issue with The solution is in these two comments: The important thing is that upgrading React Native is not (usually) simply a case of updating the version number in |
@mjmasn I am getting below error using above solution Error :
|
I had the exact same issue, with none of the steps above working. I eventually realized that when I ran |
It is now working. After modification of relevent file mentioned in above url and cd android && ./gradlew clean, the app is working as expected with Hermes enabled. Link to commit in my repo for these changes -> bhaskarGyan/react-native-memory-profile@3d05ebc |
@bhaskarGyan Any clue for that? Thanks |
@vodanh109 , is it even after ./gradlew clean? can you share sample project github url? |
@bhaskarGyan yeap, even after ./gradlew clean, still crashed after starting up. I just use the initial project, no more change |
I think I passed this issue, via ./gradlew clean, but now I have problem same as #25599 when run with --variant release |
+1 |
I got the same error (couldn't find DSO to load: libhermes.so) even with hermes disabled and
and I guess the hermes error happens because of the fallback. I had this in my root build.gradle:
where I added jitpack because of a 3rd party library requirement. After changing to this (separate blocks):
The issue is gone and app doesn't crash anymore. So it looks like build succeeds but resulting APK doesn't contain the right 'jsc' libraries, probably because download fails in the maven directive (don't have a real explanation btw). |
Install Hermes Engine. |
In react.gradle there are checks like this: targetName.toLowerCase().contains("release") So I've decided to just rename my custom target name from |
This worked for me! |
After enabling Hermes in your project, Please update the Hermes path in "android/app/build.gradle" file. You can see the sample code below.
After the update of hermesPath, run your application |
hi I follow yours modifications, but there will be a Error "libjsexecutor.so not found", and add this #25537 (comment) modification, app works fine |
Should be this as of
|
@juicycleff I can confirm that this works with |
Thanks @aliozinan ! I'm on RN 0.61.2 and fixed by replacing
Now everything works properly. |
Doesn't work. |
The error you're getting is clearly telling you that a property was being set multiple times in the object definition during the build process. This issue is about enabling Hermes Engine and building the project successfully by resolving the "DSO not found" error, hence your issue is not related to this one and should be investigated seperately. So as a result, my solution actually works for the related issue being this one. Try with 0.60.0 or 0.61.1 versions, apply the solution recommended in the above messages and check if you're able to get a successful build. If you get "DSO not found" error, report here. Finally, remove the reference in your message here to the issue you opened, it's a wrong reference. |
In my side the problem was fixed when I run 'Clean project' and then run again. |
i did the same thing, alongwith "def enableProguardInReleaseBuilds = false" in the same file, |
For people with more build types (let's call it anotherDebug):
|
For anyone having this issue, this may help. From React native docs:
That means Hermes is only for Hope this help
|
@maitrungduc1410 oh my god, I've been banging my head on the wall for hours with that. That being said, it now says:
|
This solved my issue, thank you @nokite . |
+++ |
I don't have any more than the already present build types, but I did add product flavors and here's my build.gradle... And it is crashing without giving any logs
|
Whats this is !?
…On Thu, 22 Apr 2021 at 3:24 PM Shehar Yar Khan ***@***.***> wrote:
I don't have any more than the already present build types, but I did add
product flavors and here's my build.gradle... And it is crashing without
giving any logs
`
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
- The react.gradle file registers a task for each build variant (e.g.
bundleDebugJsAndAssets
- and bundleReleaseJsAndAssets).
- These basically call react-native bundle with the correct arguments
during the Android build
- cycle. By default, bundleDebugJsAndAssets is skipped, as in
debug/dev mode we prefer to load the
- bundle directly from the development server. Below you can see all
the possible configurations
- and their defaults. If you decide to add a configuration block, make
sure to add it before the
- apply from: "../../node_modules/react-native/react.gradle" line.
-
- project.ext.react = [
- // the name of the generated asset file containing your JS bundle
- bundleAssetName: "index.android.bundle",
-
- // the entry file for bundle generation. If none specified and
- // "index.android.js" exists, it will be used. Otherwise "index.js"
is
- // default. Can be overridden with ENTRY_FILE environment variable.
- entryFile: "index.android.js",
-
- // https://reactnative.dev/docs/performance#enable-the-ram-format
- bundleCommand: "ram-bundle",
-
- // whether to bundle JS and assets in debug mode
- bundleInDebug: false,
-
- // whether to bundle JS and assets in release mode
- bundleInRelease: true,
-
- // whether to bundle JS and assets in another build variant (if
configured).
- // See
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
- // The configuration property can be in the following formats
- // 'bundleIn${productFlavor}${buildType}'
- // 'bundleIn${buildType}'
- // bundleInFreeDebug: true,
- // bundleInPaidRelease: true,
- // bundleInBeta: true,
-
- // whether to disable dev mode in custom build variants (by default
only disabled in release)
- // for example: to disable dev mode in the staging build type (if
configured)
- devDisabledInStaging: true,
- // The configuration property can be in the following formats
- // 'devDisabledIn${productFlavor}${buildType}'
- // 'devDisabledIn${buildType}'
-
- // the root of your project, i.e. where "package.json" lives
- root: "../../",
-
- // where to put the JS bundle asset in debug mode
- jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
-
- // where to put the JS bundle asset in release mode
- jsBundleDirRelease: "$buildDir/intermediates/assets/release",
-
- // where to put drawable resources / React Native assets, e.g. the
ones you use via
- // require('./image.png')), in debug mode
- resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
-
- // where to put drawable resources / React Native assets, e.g. the
ones you use via
- // require('./image.png')), in release mode
- resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
-
- // by default the gradle tasks are skipped if none of the JS files
or assets change; this means
- // that we don't look at files in android/ or ios/ to determine
whether the tasks are up to
- // date; if you have any other folders that you want to ignore for
performance reasons (gradle
- // indexes the entire tree), add them here. Alternatively, if you
have JS files in android/
- // for example, you might want to remove it from here.
- inputExcludes: ["android/*", "ios/*"],
-
- // override which node gets called and with what additional arguments
- nodeExecutableAndArgs: ["node"],
-
- // supply additional arguments to the packager
- extraPackagerArgs: []
- ]
*/
project.ext.react = [
entryFile: "index.js",
enableHermes: true
]
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
apply from: "../../node_modules/react-native/react.gradle"
apply from:
"../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
/**
- Set this to true to create two separate APKs instead of one:
-
- An APK that only works on ARM devices
-
- An APK that only works on x86 devices
- The advantage is the size of the APK is reduced by about 4MB.
- Upload all the APKs to the Play Store and people will download
- the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
- Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
/**
- The preferred build flavor of JavaScriptCore.
-
- For example, to use the international variant, you can use:
- def jscFlavor = 'org.webkit:android-jsc-intl:+'
-
- The international variant includes ICU i18n library and necessary
data
- allowing to use e.g. Date.toLocaleString and String.localeCompare
that
- give correct results when using with locales other than en-US. Note
that
- this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
- Whether to enable the Hermes VM.
-
- This should be set on project.ext.react and mirrored here. If it is
not set
- on project.ext.react, JavaScript will not be compiled to Hermes
Bytecode
- and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.coolconnect.pax"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 7
versionName "1.0.7"
manifestPlaceholders = [appAuthRedirectScheme: 'com.coolconnect.pax']
resConfigs "en", "es"
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
shrinkResources true
}
}
flavorDimensions "Default"
productFlavors {
TaxisPlus {
applicationId 'com.taxisplus.pax'
}
CoolConnect {
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.android.support:appcompat-v7:23.0.1"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation 'com.google.firebase:firebase-core:16.0.7'
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
addUnimodulesDependencies()
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// 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:
***@***.***/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
`
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#25601 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIVHJXYGIF6K5D7C62RRS3TTKAPSXANCNFSM4IB7MAMQ>
.
|
android/app/build.gradle @77TecShaeer |
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
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 21.1.2, 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0
System Images: android-23 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-27 | Android TV Intel x86 Atom, android-27 | Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: ^0.60.3 => 0.60.3
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
m-c02xf2cejg5h:reactNativeMemoryProfi
Steps To Reproduce
Describe what you expected to happen:
App should not crash
Snack, code example, or link to a repository:
https://github.com/bhaskarGyan/react-native-memory-profile/tree/bug/rn-0.60.3_hermes
The text was updated successfully, but these errors were encountered: