SO loader not found: libhermes-executor-release.so
Description
it is a working app that has been deployed for a year now...nothing major was changed but suddenly this started appearing: Fatal: couldn't find DSO to load: libhermes-executor-release.so
I have tried the following already:
lowering the SOLoader version
upgrading soLoader to the latest version avaliable
Changing build variant (I only have debug and release only)
having configurations.all in module/build.gradle that sets react-native
and other solutions recommended but nothing seems to work. I can't upgrade react-native now since we have a bit involved native libs/dependencies in place already that would break.
my app/builde.gradle looks like:
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
import com.android.build.OutputFile
project.ext.react = [
enableHermes: true, // clean and rebuild if changing,
hermesFlagsRelease: ["-w", "-O", "-output-source-map"], // add this,
hermesFlagsDebug: ["-w", "-O", "-output-source-map"], // add this,
bundleAssetName: "index.android.bundle",
entryFile: "index.js",
bundleInDebug: false,
bundleInRelease: true,
devDisabledInStaging: true,
root: "../../",
jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
jsBundleDirRelease: "$buildDir/intermediates/assets/release",
resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
]
project.ext.sentryCli = [
logLevel: "debug",
sentryProperties: "../sentry.properties"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = true
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", true);
project.ext.envConfigFiles = [
debug: ".env",
release: "release.env"
]
//to avoid building issues with mahcrest and junit in so emlibraries, likely signaturepad
//https://stackoverflow.com/questions/59085448/duplicate-class-org-hamcrest-basedescription-found-in-modules-jetified-hamcrest
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('org.hamcrest:hamcrest-core:1.1') with module('junit:junit:4.12')
}
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8 }
// ndkVersion '21.3.6528147' // The version installed on build machines, see https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "org.oneacrefund.fieldapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 40
versionName "1.8.6"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk true // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
// You can set these in your own ~/.gradle/gradle.properties
if (project.hasProperty('FOAPP_RELEASE_STORE_FILE')) {
storeFile file(FOAPP_RELEASE_STORE_FILE)
storePassword FOAPP_RELEASE_STORE_PASSWORD
keyAlias FOAPP_RELEASE_KEY_ALIAS
keyPassword FOAPP_RELEASE_KEY_PASSWORD
}
}
}
namespace 'org.oneacrefund.fieldapp'
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.release
matchingFallbacks = ['release']
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
}
stagingrelease {
initWith(buildTypes.release)
applicationIdSuffix ".staging"
}
productionrelease {
initWith release
}
}
packagingOptions {
jniLibs {
pickFirsts += ['lib/x86/libc++_shared.so', 'lib/x86_64/libc++_shared.so', 'lib/armeabi-v7a/libc++_shared.so', 'lib/arm64-v8a/libc++_shared.so', '**/*.so', 'lib/armeabi-v7a/libc++_shared.so', 'lib/arm64-v8a/libc++_shared.so', 'lib/x86/libc++_shared.so', 'lib/x86_64/libc++_shared.so']
}
}
// 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:0.67.3" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
androidTestImplementation 'junit:junit:4.12'
implementation "androidx.annotation:annotation:1.1.0"
//implementation 'com.google.code.gson:gson:2.8.6'
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation project(':flipper-plugin-rn-performance-android')
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation ("com.facebook.flipper:flipper-leakcanary2-plugin:${FLIPPER_VERSION}"){
exclude group:'com.facebook.fbjni'
}
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation "androidx.core:core-ktx:1.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(':reactnativesignaturecapture')
}
// 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'
}
project.ext.vectoricons = [
iconFontNames: [ 'MaterialIcons.ttf', 'MaterialCommunityIcons.ttf' ] // Name of the font files you want to copy
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
repositories {
mavenCentral()
}
builde.gradle
buildscript {
ext.kotlin_version = '1.6.10'
ext {
minSdkVersion = 22
compileSdkVersion = 31
targetSdkVersion = 31
buildToolsVersion = "29.0.3" // should have been picked up automatically but detox complains. you can put an older build version in comparison
// the compile sdk version and latest one will be picked up
}
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:4.2.2')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://repo1.maven.org/maven2' }
mavenLocal()
//maven { url 'https://dl.bintray.com' }
maven { url("$rootDir/../node_modules/detox/Detox-android") }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
mavenCentral()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
React Native Version
0.67.4
Output of npx react-native info
System: OS: macOS 13.0.1 CPU: (8) arm64 Apple M1 Memory: 57.58 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.0.0 - ~/.nvm/versions/node/v16.0.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.0.0/bin/yarn npm: 7.10.0 - ~/.nvm/versions/node/v16.0.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 16.0.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Not sure why it says Android Studio is not found...I do have a working AS Android Studio Dolphin | 2021.3.1 P
Steps to reproduce
do npm start and
cd android && ./gradlew clean && cd .. && react-native run-android
Snack, code example, screenshot, or link to a repository
2023-03-08 18:09:13.844 8042-8042 AndroidRuntime com.gmovers.clientf E FATAL EXCEPTION: main
Process: com.gmovers.clientf, PID: 8042
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.gmovers.clientf/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.gmovers.clientf-TLmAF5isuTYYKUSVROvzuA==/lib/x86 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
Native lib dir: /data/app/com.gmovers.clientf-TLmAF5isuTYYKUSVROvzuA==/lib/x86
result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:30)
at com.facebook.hermes.reactexecutor.HermesExecutor.
| :warning: | Unsupported Version of React Native |
|---|---|
| :information_source: | It looks like your issue or the example you provided uses an unsupported version of React Native. Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support. |
As I mentioned in other related issue, most of the "couldn't find DSO to load" crashes are fixed in version 0.71 of React Native.
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.