couldn’t find DSO to load: libhermes.so SoSource

I have a react native application and the following is the output of npx react-native info for me:

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M2
    Memory: 121.06 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
    Watchman: 2024.04.08.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK: Not Found
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.11090377
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.22 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.6 => 0.70.6
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

And this is my app/build.gradle

apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os

project.ext.react = [
    enableHermes: false,  // clean and rebuild if changing
    entryFile: "index.js",
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = true

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

def reactNativeArchitectures() {
    def value = project.getProperties().get("reactNativeArchitectures")
    return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "org.mentortogether.mentorship"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 902007
        versionName "9.2.7"
        buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

        if (isNewArchitectureEnabled()) {
            externalNativeBuild {
                cmake {
                    arguments "-DPROJECT_BUILD_DIR=$buildDir",
                        "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
                        "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
                        "-DNODE_MODULES_DIR=$rootDir/../node_modules",
                        "-DANDROID_STL=c++_shared"
                }
            }
            if (!enableSeparateBuildPerCPUArchitecture) {
                ndk {
                    abiFilters (*reactNativeArchitectures())
                }
            }
        }
    }

    if (isNewArchitectureEnabled()) {
        externalNativeBuild {
            cmake {
                path "$projectDir/src/main/jni/CMakeLists.txt"
            }
        }
        def reactAndroidProjectDir = project(':ReactAndroid').projectDir
        def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
            dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
            from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
            into("$buildDir/react-ndk/exported")
        }
        def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
            dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
            from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
            into("$buildDir/react-ndk/exported")
        }
        afterEvaluate {
            preDebugBuild.dependsOn(packageReactNdkDebugLibs)
            preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)

            configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
            configureCMakeDebug.dependsOn(preDebugBuild)
            reactNativeArchitectures().each { architecture ->
                tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
                    dependsOn("preDebugBuild")
                }
                tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
                    dependsOn("preReleaseBuild")
                }
            }
        }
    }

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include (*reactNativeArchitectures())
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            storeFile file('mentortogo-release-key.jks')
            storePassword 'password'
            keyAlias 'mentortogo'
            keyPassword 'password'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    flavorDimensions "mentortogo"
    productFlavors {
        staging {
            dimension "mentortogo"
            manifestPlaceholders = [bugsnagReleaseStage: "staging"]
        }
        prod {
            dimension "mentortogo"
            manifestPlaceholders = [bugsnagReleaseStage: "production"]
        }
    }

    def versionArray = getNpmVersionArray()
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            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 + versionArray[0]*10000 + versionArray[1]*100 + versionArray[2]
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation'com.facebook.soloader:soloader:0.11.0+'

    implementation("com.facebook.react:react-native:+") {
        exclude group: 'com.facebook', module: 'hermes'
    }

    implementation("com.facebook.react:react-native") {
        version {
            strictly "0.70.6"
        }
    }

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    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'
    }

    if (enableHermes) {
        implementation("com.facebook.react:hermes-engine:+") { // From node_modules
            exclude group:'com.facebook.fbjni'
        }
    } else {
        implementation jscFlavor
    }
}

if (isNewArchitectureEnabled()) {
    configurations.all {
        resolutionStrategy.dependencySubstitution {
            substitute(module("com.facebook.react:react-native"))
                    .using(project(":ReactAndroid"))
                    .because("On New Architecture we're building React Native from source")
            substitute(module("com.facebook.react:hermes-engine"))
                    .using(project(":ReactAndroid:hermes-engine"))
                    .because("On New Architecture we're building Hermes from source")
        }
    }
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

def isNewArchitectureEnabled() {
    return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

and this is my build.gradle code

import groovy.json.JsonSlurper

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 24
        compileSdkVersion = 33
        targetSdkVersion = 33

        if (System.properties['os.arch'] == "aarch64") {
            ndkVersion = "24.0.8215888"
        } else {
            ndkVersion = "21.4.7075529"
        }
    }
    repositories {
        google()
        maven {
            url 'https://maven.fabric.io/public'
        }
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:6.6.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        classpath('com.google.gms:google-services:4.3.3')
        classpath('io.fabric.tools:gradle:1.31.2')
        classpath('com.bugsnag:bugsnag-android-gradle-plugin:5.+')
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
    }
}

allprojects {
    repositories {
        mavenCentral {
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven {
            url ("$rootDir/../node_modules/react-native/android")
        }
        maven {
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
        maven {
            url 'https://www.jitpack.io'
        }
        maven {
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
        configurations.all {
            resolutionStrategy {
                eachDependency { DependencyResolveDetails details ->
                    if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
                        def file = new File("$rootDir/../node_modules/react-native/package.json")
                        def version = new groovy.json.JsonSlurper().parseText(file.text).version
                        details.useVersion version
                    }
                }
            }
        }
    }
}

def getNpmVersionName() {
    def inputFile = new File("../package.json")
    def packageJson = new JsonSlurper().parseText(inputFile.text)
    return packageJson["version"]
}

def getNpmVersionArray() {
    def (major, minor, patch) = getNpmVersionName().minus(~/-.*/).tokenize('.')
    return [Integer.parseInt(major), Integer.parseInt(minor), Integer.parseInt(patch)] as int[]
}

In my application I disabled hermes, and after disabling hermes I started to get this error only, on some Android 10 devices.

Fatal Exception: java.lang.UnsatisfiedLinkError
dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/base.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.arm64_v8a.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.bn.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.en.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.gu.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.hi.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.mr.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/lib/arm64, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/base.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.bn.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.en.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.gu.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.hi.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.mr.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libhermes.so"

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/base.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.arm64_v8a.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.bn.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.en.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.gu.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.hi.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.mr.apk", zip file "/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/lib/arm64, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/base.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.bn.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.en.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.gu.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.hi.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.mr.apk!/lib/arm64-v8a, /data/app/org.mentortogether.mentorship-AMBt-GyVwMiPAlRVJO5lMA==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libhermes.so"
       at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
       at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
       at java.lang.System.loadLibrary(System.java:1667)
       at com.facebook.soloader.nativeloader.SystemDelegate.loadLibrary(SystemDelegate.java)
       at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:52)
       at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:30)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:774)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:25)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
       at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:393)
       at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:343)
       at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:96)
       at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
       at org.mentortogether.mentorship.MainApplication.onCreate(MainApplication.java:73)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6852)
       at android.app.ActivityThread.access$1300(ActivityThread.java:268)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1982)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7807)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)

I researched and tried all the possible solutions mentioned in the React Native Library repository to the similar issues, but got no luck till now.

New contributor

Abhishek Khanduri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật