react-native: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found

App crash on Android integration with existing apps.

Crash log.

E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
2019-07-07 18:59:27.223 10045-10073/com.mihir.reactApp E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.mihir.reactApp, PID: 10045
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
        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.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:19)
        at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
        at java.lang.Thread.run(Thread.java:764)

React Native version:

System: OS: macOS 10.14.5 CPU: (8) x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz Memory: 1.19 GB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 12.5.0 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: Android SDK: API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29 Build Tools: 23.0.1, 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.0, 29.0.0 System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: /undefined - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: ^0.60.0 => 0.60.0 npmGlobalPackages: react-native-cli: 2.0.1

Steps To Reproduce

  1. Create a new Android app which uses AndroidX.
  2. Add react-native to Android application as, implementation ‘com.facebook.react:react-native:+’
  3. Run app on any android device/emulator.

Sample project on GitHub which reproduces crash.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 122
  • Comments: 187 (19 by maintainers)

Commits related to this issue

Most upvoted comments

hi @mhrpatel12 ,

I’m having same issue. You can follow this link.

Add following code in build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

View the upgrade guide https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0

You’re likely missing the step android/build.gradle

allprojects {
    repositories {
        mavenLocal()
        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()
        jcenter()
    }
}

Add following code in app/build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

For me worked that fix with

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

in build.gradle

it is work for me, thanks

Add following code in app/build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

For me worked that fix with

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

in build.gradle

What fixed it for us was upgrading the SOLoader.

In android/app/build.gradle:

implementation 'com.facebook.soloader:soloader:0.9.0+'

def useIntlJsc = false

Still no working,

check your android/app/build.gradle

android {
   ...
   packagingOptions {
        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/x86/libjsc.so'
        pickFirst '**/armeabi-v7a/libjsc.so'
    }
}
E/SoLoader: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libglog_init.so caused by: couldn't find DSO to load: libglog.so caused by: APK was built for a different platform

Tried every single solution in the thread and it doesn’t work. I vent from RN 0.59 to 0.62… Same error. Every minor update is a breaking update. It really starts to bother us.

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.

Best regards.

I hit this issue today when we downgraded from 0.68 to 0.67.x for RN.

it appears the hermes-<release and debug>.aar both depend on libjscexecutor.so … probably because hermes didnt have full feature parity and they relied on some parts of the previous runtime to do the job… I donno exactly

When building the debug version and hermes in enabled, libjscexecutor.so is packaged with the APK. When building the release package it is removed.

After looking at the /node_modules/react-native/build.gradle, I seen there was a flag to leave “un-needed” libraries. Setting


project.ext.react = [
    enableHermes: true,         // clean and rebuild if changing
    enableVmCleanup: false, //this
]

I can see that libjscexecutor.so is in the resulting apk and the app works correctly!!!

I further looked at RN 0.68.X and seen it is compiled with hermes 0.11.0, looking at a fresh app’s apk I see no “libjscexecutor.so” is packaged in the APK and the app works. Also, the dependency in hermes-<debug and release> has been removed.

I hope this help some poor soul out there.

Here is how I fix it.

Basically I initialised new Android project and compared all the changes in the main file (build.gradle). Doing these changes made my app run again.

I upgraded from RN 59.(Some Version) to 62.2

In gradle.properties, add following

FLIPPER_VERSION=0.33.1

In MainApplication.java add following import

import com.facebook.react.ReactInstanceManager;

in build.gradle at android/app/build.gradle add following inside android {

    packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "lib/x86_64/libc++_shared.so"
    }

And following in dependencies

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

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

If you BasePackageList.java file in android/app/src/main/java/com/{projectName)/generated/BasePackageList.java then delete this file.

This should fix

Basically I initialised new Android project and compared all the changes in the main file (build.gradle). Doing these changes made my app run again.

Also, Maybe they had some guide on how to update to RN 0.60+ which I never went through (dependent bot updated my project)

I think if peoples sure that config for android correct. So, check your android/app/build.gradle

If have two lines after:

    pickFirst '**/x86_64/libjsc.so'
    pickFirst '**/arm64-v8a/libjsc.so'

~Remove it resolved my problem. So hope it will help all you guys~

Replace your packagingOptions with values from default RN config

packagingOptions {
            pickFirst '**/armeabi-v7a/libc++_shared.so'
            pickFirst '**/x86/libc++_shared.so'
            pickFirst '**/arm64-v8a/libc++_shared.so'
            pickFirst '**/x86_64/libc++_shared.so'
            pickFirst '**/x86/libjsc.so'
            pickFirst '**/armeabi-v7a/libjsc.so'
}

Here is how I managed to solve the problem.

  1. Open your project with android studio (open the android folder of your project ONLY), and let android studio index your project fully, then close it (android studio).
  2. Delete the node_modules folder: rm -rf node_modules.
  3. Delete the android/app/build folder.
  4. Reinstall the node_modules: yarn install (from the root of your project)
  5. Rebuild your project: npx react-native run-android
  6. Your project should work again.

在app / build.gradle中添加以下代码

def useIntlJsc = false

在依赖中添加以下内容

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

对我来说,修复过

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

在build.gradle中

这对我有用,谢谢 this fixed my problem.

Updating the SoLoader worked for me too, but after a deeper dive I think this is just a caching issue. Try:

cd android && ./gradlew clean

@mhrpatel12 Have you made sure $rootDir/../node_modules/jsc-android/dist is a valid path in your project? If not, you need to do an npm install --save jsc-android

@cortinico I also have the same error I’m using expo 49 and react-native 0.72.3

Getting this crash in specific device OnePlus8Pro Android 11. Generating aab file. Any one have quick solution?

_Fatal Exception: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libjscexecutor.so caused by: couldn’t find DSO to load: libfb.so caused by: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.disctopia.android/lib-3/libc++shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0

Firebase crashlytics detected a similar crash on a OnePlus8 Pro. The app was on RN 0.70.4.

Below was the error log captured. Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.wagesplitter.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:896) at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:725) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:649) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:629) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577) at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:25) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:19) 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 com.wagesplitter.app.MainApplication.onCreate(MainApplication.java:66) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1194) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6756) at android.app.ActivityThread.access$1300(ActivityThread.java:238) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7701) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

A note to anyone still struggling, and to reiterate what others have said above: That error you get in logcat…

couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found

… is not a fatal error. It has no effect on anything. It doesn’t cause a crash/freeze.

In our case (like many others above) it was our javascript that was causing our app to freeze during startup. Why? The production build of our app (RN 0.63.3, hermes 0.5.1) had obfuscated js which was completely borking hermes. Logcat was giving us no clues and there was no crash.

Solution that worked for me, In app/build.gradle change implementation "com.facebook.react:react-native:0.66.3" to

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

Hi @ilyagru, @Yandamuri,

Did you guy solve the issue on RN 0.68.2. I’m facing the same issue when trying to use Dexguard(with either Hermes enable or not).
Even when the libjscexecutor.so is found but still causing the running time error.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so

Any helps please? Really appreciate that. Thanks Screen Shot 2022-09-10 at 13 15 42

Add following code in app/build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

For me worked that fix with

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

in build.gradle

@Villar74 thanks its work for me.

Facing the same issue in an Expo project, any solution for this ?

"react-native": "0.72.3",
"expo": "49.0.7",
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libreact_render_runtimescheduler.so caused by: couldn't find DSO to load: libreact_render_core.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.thrilld.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1228)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:1044)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:956)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:903)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
       at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:34)
       at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:17)
       at com.facebook.react.bridge.Arguments.createMap(Arguments.java:159)
       at expo.modules.updates.statemachine.UpdatesStateContext.getWritableMap(UpdatesStateContext.kt:53)
       at expo.modules.updates.UpdatesController.sendUpdateStateChangeEventToBridge(UpdatesController.kt:561)
       at expo.modules.updates.statemachine.UpdatesStateMachine.sendChangeEventToJS(UpdatesStateMachine.kt:65)
       at expo.modules.updates.statemachine.UpdatesStateMachine.processEvent(UpdatesStateMachine.kt:47)
       at expo.modules.updates.UpdatesController$start$1.onRemoteCheckForUpdateStarted(UpdatesController.kt:285)
       at expo.modules.updates.loader.LoaderTask.launchRemoteUpdateInBackground$lambda$1(LoaderTask.kt:313)
       at expo.modules.updates.loader.LoaderTask.$r8$lambda$jwzCL9xjo0jbCNnExNO-hPCX6iI()
       at expo.modules.updates.loader.LoaderTask$$ExternalSyntheticLambda1.run(:6)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

cd android && ./gradlew clean

I have this issue couldn't find DSO to load: libjscexecutor.so and I even have Hermes enabled.

I facing the same issue.

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.

Best regards.

i did this process but still coming error java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libjscexecutor.so caused by: couldn’t find DSO to load: libjsc.so this almost killing me…

Trying to upgrade RN from 0.59.9 to 0.62.2

E/SoLoader: couldn't find DSO to load: libjsc.so
E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: couldn't find DSO to load: libjsc.so
A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x732bafdfc4 in tid 10097 (mqt_js), pid 10015 

@nicsachin For me, it’s still not working. Did you tried running the sample project I’ve shared?

I solved it this way, friends who encounter this problem can try: The first: You need to change the app/gradle

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId ""
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

project.ext.react = [
        enableHermes: false,
]

def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation "com.facebook.react:react-native:+"
    implementation 'com.android.support:support-annotations:27.1.1'

    if (enableHermes) {
        implementation project(':hermes-engine')
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

The second: You need to change the principal’s gradle

    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
        mavenLocal()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        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")
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

The third: You need to add the next at setting gradle

rootProject.name='Notes'


include ':hermes-engine'
project(':hermes-engine').projectDir = new File(rootProject.projectDir, '../node_modules/hermes-engine/android/')

from:https://stackoverflow.com/questions/59604146/react-native-compile-bundle-with-android-studio

My build.gradle (app)

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: false, // clean and rebuild if changing bundleInStaging: true, // Add this bundleInInternalTest: true, // Add this bundleInRelease: true, hermesCommand: “…/…/node_modules/hermes-engine/%OS-BIN%/hermes”, ]

apply from: “…/…/node_modules/react-native/react.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 = false

/**

  • 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.test"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    ndk { abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64" }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // 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'
    }
}
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"
    }
}

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

    }
}
def taskName = getGradle().getStartParameter().getTaskRequests().toString()


packagingOptions {
    pickFirst "lib/armeabi-v7a/libc++_shared.so"
    pickFirst "lib/arm64-v8a/libc++_shared.so"
    pickFirst "lib/x86/libc++_shared.so"
    pickFirst "lib/x86_64/libc++_shared.so"
    //pickFirst '**/armeabi-v7a/libc++_shared.so'
    //pickFirst '**/x86/libc++_shared.so'
    //pickFirst '**/x86_64/libc++_shared.so'
    //pickFirst '**/arm64-v8a/libc++_shared.so'
    //pickFirst '**/libjsc.so'

// //pickFirst ‘/libhermes-inspector.so’ //pickFirst '/libjscexecutor.so’ //pickFirst ‘/lib-main/libhermes-inspector.so’ // exclude '/libhermes-inspector.so’ exclude ‘/libjscexecutor.so’ // exclude “lib/arm64-v8a/libgnustl_shared.so” // exclude '/lib/mips64/’ // exclude ‘/lib/arm64-v8a/’ // exclude '/lib/x86_64/

    exclude "**/libjsc*.so"
    if (taskName.contains("InternalDebug")) {
        // Release libs take precedence and must be removed
        // to allow debugging
        exclude '**/libhermes-executor-release.so'
    } else {
        // Reduce size by deleting the debugger/inspector
        exclude '**/libhermes-inspector.so'
        exclude '**/libhermes-executor-debug.so'
    }
}

}

dependencies { implementation fileTree(dir: “libs”, include: [“*.jar”]) //noinspection GradleDynamicVersion implementation ‘com.facebook.soloader:soloader:0.9.0+’

configurations.all {
    resolutionStrategy {
        force "com.facebook.soloader:soloader:0.8.2"
    }
}
implementation 'androidx.appcompat:appcompat:1.2.0'

implementation "com.facebook.react:react-native:+"  // From node_modules

implementation("com.facebook.infer.annotation:infer-annotation:0.11.2")
implementation("javax.inject:javax.inject:1")
implementation("androidx.appcompat:appcompat:1.2.0")
implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"
implementation("com.facebook.fresco:fresco:2.2.0")
implementation("com.facebook.fresco:imagepipeline-okhttp3:2.0.0")
implementation("com.facebook.soloader:soloader:0.9.0")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.squareup.okhttp3:okhttp:3.14.1")
implementation("com.squareup.okhttp3:okhttp-urlconnection:3.12.1")
implementation("com.squareup.okio:okio:1.17.2")

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation(project(':react-native-jitsi-meet')) {
    //exclude group: 'com.facebook.react',module:'react-native-vector-icons'
    //exclude group: 'com.facebook.react',module:'react-native-community-async-storage'
    exclude group: 'com.facebook',module:'hermes'
    transitive = true

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

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")
    anotherDebugImplementation 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: file(“…/…/node_modules/@react-native-community/cli-platform-android/native_modules.gradle”); applyNativeModulesAppBuildGradle(project)

Did you add below in android/app/build.gradle?

def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }

how to fix this stupid issue wtf ?

Facing the same issue in an Expo project, any solution for this ?

"react-native": "0.72.3",
"expo": "49.0.7",
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libreact_render_runtimescheduler.so caused by: couldn't find DSO to load: libreact_render_core.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.thrilld.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1228)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:1044)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:956)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:903)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
       at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:34)
       at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:17)
       at com.facebook.react.bridge.Arguments.createMap(Arguments.java:159)
       at expo.modules.updates.statemachine.UpdatesStateContext.getWritableMap(UpdatesStateContext.kt:53)
       at expo.modules.updates.UpdatesController.sendUpdateStateChangeEventToBridge(UpdatesController.kt:561)
       at expo.modules.updates.statemachine.UpdatesStateMachine.sendChangeEventToJS(UpdatesStateMachine.kt:65)
       at expo.modules.updates.statemachine.UpdatesStateMachine.processEvent(UpdatesStateMachine.kt:47)
       at expo.modules.updates.UpdatesController$start$1.onRemoteCheckForUpdateStarted(UpdatesController.kt:285)
       at expo.modules.updates.loader.LoaderTask.launchRemoteUpdateInBackground$lambda$1(LoaderTask.kt:313)
       at expo.modules.updates.loader.LoaderTask.$r8$lambda$jwzCL9xjo0jbCNnExNO-hPCX6iI()
       at expo.modules.updates.loader.LoaderTask$$ExternalSyntheticLambda1.run(:6)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

me too I ++ Screen Shot 2023-09-21 at 9 51 22 AM

I have the same problem but i am using Hermes. The app is working.

my build.gradle

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Appart from this it is the same basic build.gradle as the RN 0.63 template

Adding the jscFlavor implementation when using Hermes works but I assume it will package a useless lib in the bundle

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        implementation jscFlavor // Adding this remove the error
    } else {
        implementation jscFlavor
    }

Facing the same issue in an Expo project, any solution for this ?

"react-native": "0.72.3",
"expo": "49.0.7",
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libreact_render_runtimescheduler.so caused by: couldn't find DSO to load: libreact_render_core.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.thrilld.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1228)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:1044)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:956)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:903)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
       at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:34)
       at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:17)
       at com.facebook.react.bridge.Arguments.createMap(Arguments.java:159)
       at expo.modules.updates.statemachine.UpdatesStateContext.getWritableMap(UpdatesStateContext.kt:53)
       at expo.modules.updates.UpdatesController.sendUpdateStateChangeEventToBridge(UpdatesController.kt:561)
       at expo.modules.updates.statemachine.UpdatesStateMachine.sendChangeEventToJS(UpdatesStateMachine.kt:65)
       at expo.modules.updates.statemachine.UpdatesStateMachine.processEvent(UpdatesStateMachine.kt:47)
       at expo.modules.updates.UpdatesController$start$1.onRemoteCheckForUpdateStarted(UpdatesController.kt:285)
       at expo.modules.updates.loader.LoaderTask.launchRemoteUpdateInBackground$lambda$1(LoaderTask.kt:313)
       at expo.modules.updates.loader.LoaderTask.$r8$lambda$jwzCL9xjo0jbCNnExNO-hPCX6iI()
       at expo.modules.updates.loader.LoaderTask$$ExternalSyntheticLambda1.run(:6)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

me too I ++ Screen Shot 2023-09-21 at 9 51 22 AM

Having the same issue with the same specs

I am also facing this issue in an expo project. App runs fine in expo go. The APK built using EAS installs in a device but crashes when I opened it. Is there any permanent fix for this issue?

Adding implementation 'com.facebook.soloader:soloader:0.10.5+' in dependencies of android/app/build.gradle fixed the issue for me.

Hermes: disabled React Native: 0.62.2

For the folks upgrading to RN 0.70, we need to replace this if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") implementation jscFlavor // It's important }

with

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

This only works in debug mode and not in release mode. Turns out, my build types were causing the issue. I was attempting to build a develop or staging mode with debuggable set to false. Any non-debuggable versions need to have the name “release” as part of it, so I could either replace my build variant names from develop to developRelease or staging to stagingRelease.

Instead, in project.ext.react, I had to add this since we have develop and staging versions that are non-debuggable. deleteDebugFilesForVariant: { def variant -> variant.name.toLowerCase().contains("release") || variant.name.toLowerCase().contains("staging") || variant.name.toLowerCase().contains("develop") }

The react native module’s react.gradle file has this which caused the issue: def deleteDebugFilesForVariant = config.deleteDebugFilesForVariant ?: { def variant -> variant.name.toLowerCase().contains("release") }

But, “libjsc.so” is still missing, I guess hermes still depends on jsc,So I’m still relying on jsc while enabling the hermes engine, here is my gradle configuration. Solved the crash problem in release mode.

That’s not correct. Hermes and JSC are completely independent. On console, you will see that the app tries to load JSC first, and fallbacks to Hermes if not found. That’s the reason why you see a failed to load libjsc.so message.

Your app might crash for anothe reason and you’re probably blaming this line instead.

Also a heads up here:

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
    enableVmCleanup: false, //this
]

That might solve some of the issues, but you’re disabling the cleanup of the APK from unused .so resulting in a bigger app size at the end of the day.

@Yandamuri @MaxJadav

We also noticed the same crash from this specific device OnePlus8Pro Android 11. (and we also use aab). The RN version is 0.63.4 + Hermes. Other devices doesn’t have this issue.

Getting this crash in specific device OnePlus8Pro Android 11. Generating aab file. Any one have quick solution?

_Fatal Exception: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libjscexecutor.so caused by: couldn’t find DSO to load: libfb.so caused by: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.disctopia.android/lib-3/libc++shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0

The strategy for using JSC or Hermes is not very sophisticated, because Java lacks conditional compilation. The code for RN 0.63.0 is here: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java#L292-L329 and hasn’t changed since RN 0.63.

Basically, it tries to load JSC, and if it fails, it tries to load hermes. So the behavior you are seeing is intentional.

The problem is that gradle doesn’t automatically clean up after itself very well. So you sometimes end up with an apk which contains part of jsc and part of hermes, or neither of them, and this is unstable.

The build.gradle file says you should clean and rebuild if you enable or disable hermes: https://github.com/facebook/react-native/blob/master/template/android/app/build.gradle#L81

So make sure you run ./gradlew clean if you are experiencing weird issues. I have also seen circumstances where the apk on the device needs to be completely removed, and then reinstalled fresh.

if you have this error it means that you have a jsc aar missing, you can find it in node_modules\jsc-android\dist

Make sure it is included in your dependencies

You are probably missing some dependencies

Still the same issue from the Firebase crash on OnePlus 8, any ideas?

+1

Thanks!@Yandamuri

Add the following configuration,libjscexecutor.so is not missing in apk.

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
    enableVmCleanup: false, //this
]

But, “libjsc.so” is still missing, I guess hermes still depends on jsc,So I’m still relying on jsc while enabling the hermes engine, here is my gradle configuration. Solved the crash problem in release mode.

Step1

project.ext.react = [
        enableHermes: true,  // clean and rebuild if changing
        enableVmCleanup: false, // maybe libjscexecutor.so is missing in the release apk
]

Step2 Replace “android-jsc” to “android-jsc-intl”

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

Step3

if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        implementation jscFlavor // It's important
    } else {
        implementation jscFlavor
    }

@Yandamuri It’s not smooth 😅 , migrating from 67 to 68 I have this issue with SoLoader, so now I’m trying to see if upgrading from 67 straight to 69 would fix the issue. I can report back here once I finish 👍🏻

I have the same problem, I solved it, just try update okhttp version:

implementation("com.squareup.okhttp3:okhttp:4.9.1")

Android support version : “28.0.0”

implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support.constraint:constraint-layout:2.0.4"
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"

I’m having the same error ONLY when I build aab or apk while working just fine in direct build and install

it seems this could be caused by many different things… i didn’t have bundleInRelease: true in project.ext.react 😿

Finally I was able to solve, as mentioned in a post above, my issue wasn’t directly link to the error: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found

It was on the javascript side, what I did is comment everything in my App.tsx until the App could start without crashing and then, comment/uncomment to narrow down the culprit causing my app to crash on Android. The difficulty is that there are no logs appearing concerning that crash either in metro / flipper / crashlytics.

Good luck.

All of a sudden my app stopped running again even with gradle plugin at 3.6.0! I didn’t change anything in my android build settings. I’m out of leads here, it just stopped suddenly with apparently no change. Is this some sort of non-deterministic build issue on some platforms?

Why is RN trying to load libjscexecutor.so when we’re using hermes?

edit: doh! The issue was unrelated. The error message about missing libjsc is expected and does not cause any issues. You can see for yourself here https://github.com/facebook/react-native/blob/60e00d9d96d7b186c1d4c1542caddc1b74eeb3da/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java#L291.

My issue was that Android Studio inserted import com.facebook.react.BuildConfig; into my MainApplication.java which doesn’t cause any build failures but it does prevent the app from connecting to metro in debug mode and crashes it. Simply removing that line did the trick.

me too

@Yandamuri @MaxJadav

We also noticed the same crash from this specific device OnePlus8Pro Android 11. (and we also use aab). The RN version is 0.63.4 + Hermes. Other devices doesn’t have this issue.

Did you guys manage to solve this crash for OnePlus8Pro Android 11? I’m facing the same.

Hi,

I fixed this issue by settings multiDexEnabled to false, since I don’t require it (yet). FYI multi DEX is useful for specific cases, you might no need it.

is there any update for this issue? I tried all the ideas above and still get the same crash unfortunately

Was trying to figure this out for a while, finally realized that during our upgrade to 0.67.3 we didn’t bump our hermes-engine version to 0.10.0. If none of the solutions are working make sure you’re using the correct version! 😄 https://github.com/facebook/hermes/releases

@tomtargosz How did you do that? Using resolutions to force the hermes-engine to 0.10.0?

I’m facing the same error at 0.67.3

It’s appear that cause of this error was a missing dependency implementation that broke flipper implementation.

implementation "io.grpc:grpc-okhttp:1.32.2" solves my problem.

in /android/app/build.gradle:

View build.gradlew
dependencies {
    implementation project(':react-native-orientation')
    implementation project(':react-native-push-notification')
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    implementation fileTree(dir: "libs", include: ["*.jar"])
    add this --- >> implementation "io.grpc:grpc-okhttp:1.32.2" << --- add this

    implementation project(':react-native-keychain')
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation 'androidx.multidex:multidex:2.0.1'

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

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
}

A note to anyone still struggling, and to reiterate what others have said above: That error you get in logcat…

couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found

… is not a fatal error. It has no effect on anything. It doesn’t cause a crash/freeze.

This was true for me. Scanning the logs deeper revealed it was actually a problem with my installation of Reanimated V2, and that issue was solved with this solution.

I have the same problem but i am using Hermes. The app is working.

my build.gradle

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Appart from this it is the same basic build.gradle as the RN 0.63 template

Adding the jscFlavor implementation when using Hermes works but I assume it will package a useless lib in the bundle

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        implementation jscFlavor // Adding this remove the error
    } else {
        implementation jscFlavor
    }

@nicolasbraun This fixed it for me too after upgrading to RN 0.64.0. Did you find any different solution to avoid the duplicate lib?

It’s works with (cd android && ./gradlew clean) on Mac OS

Thanks

Also came up with a solution, had to pin some versions.

My build.gradle:

// ...
buildscript {
    // ...
    dependencies {
        // ...
        classpath('com.android.tools.build:gradle:4.0.1')
// ...

My package.json:

{
    // ...
    "dependencies": {
        // ...
        "react-native": "0.63.2",
        "hermes-engine": "^0.5.2-rc1",
    },
    "devDependencies": {
        // ...
        "metro-config": "^0.58.0",
    }
}

E.g.: hermes-engine v6 cannot be used for react-native 0.63. It is intended for 0.64. And metro-config has to be 0.58, because that’s the one that the react-native package uses as well.

Don’t forget to clean and rebuild after changing that:

cd android
./gradlew clean
cd ..
rm -rf package-lock.json
rm -rf yarn.lock
rm -rf node_modules
npm i

@SudoPlz I’ve changed my targetSdkVersion to 28 and cleaned the build folder but I’m still getting the error…

For us even though we were getting that same error in our crash reports, it wasn’t the real reason for the crash. The real reason was execute only memory which is an API 29 feature - so looks like some react native c++ lib (probably the Hermes aar) doesn’t support that feature. The workaround was to down grade the targetSdkVersion to API 28 and the crashes stopped!

Opened a ticket here https://github.com/facebook/react-native/issues/29517

E/SoLoader: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libglog_init.so caused by: couldn't find DSO to load: libglog.so caused by: APK was built for a different platform

Tried every single solution in the thread and it doesn’t work. I vent from RN 0.59 to 0.62…

Same error. Every minor update is a breaking update. It really starts to bother us.

I am able to fix it by adding the following dependencies to app/build.gradle

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

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}

and adding the version in android/gradle.properties FLIPPER_VERSION=0.33.1

@yurykorzun

if you have this error it means that you have a jsc aar missing, you can find it in node_modules\jsc-android\dist

Make sure it is included in your dependencies

How?

@crispywong thank you, it’s working now. Still, I’m confused what’s going on, why I’m able to run perfectly on version 0.59.10 without all these changes?

I’m not migrating from .59 to .60. This issue happens even on a brand new android project which uses AndroidX. You can see for yourself on sample project I created.

I’m still having the same issue with RN 0.72.6 and expo 49.0

Thanks @rossparachute and @Linuhusainnk

Updating react native version at this point is too much work for me. But I am able to run it once updated on v0.69.7

Used this as ref - https://github.com/facebook/react-native/issues/35210

why are they not answering, i am facing this issue too

Reopen this issue please

Still the same issue from the Firebase crash on OnePlus 8, any ideas?

implementation (“com.facebook.react:react-native”) version { strictly “0.66.3” }

omg. i wanna hug you. thank you. this is the only thing that worked for me

Hello, for people who just migrated to RN 0.69.+ and are facing this issue too on Android, you should update android/app/build.gradle with the following code as Hermes now comes bundled with React Native accordingly to the official documentation :

dependencies {
    // ...

    if (enableHermes) {
+       implementation("com.facebook.react:hermes-engine:+") {
+           exclude group:'com.facebook.fbjni'
+       }
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

This resolved the issue for me, hope it can help a few of you.

Best regards.

Worked for me, thanks!

I have this issue couldn't find DSO to load: libjscexecutor.so and I even have Hermes enabled.

For those still facing this issue, since RN 0.67 I encountered it when creating a new build variant for android. If you have hermes enabled, you need to add these lines in android/app/build.gradle (for a variant named beta) :

project.ext.react = [
    ...
    bundleInBeta: true,
    devDisabledInBeta: true,
    hermesFlagsForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('beta') ? ['-w'] : []
    },
    deleteDebugFilesForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('beta')
    },
]

as mentioned in https://github.com/facebook/react-native/pull/32281 (see also https://github.com/facebook/react-native/issues/33177)

I’m facing this problem only for Android 11

Hello, I have this error when I want to launch my app it crashes directly. It’s been several weeks since I have problems with Hermes. Can someone help me please

SoLoader: couldn’t find DSO to load: libjscexecutor.so result: 0 2020-11-04 11:29:23.838 4282-4599/com.test E/SoLoader: couldn’t find DSO to load: libhermes.so result: 0 2020-11-04 11:29:23.852 4282-4599/com.test E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.test, PID: 4282 java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libhermes.so result: 0 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:825) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:673) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:611) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:559) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1017) at java.lang.Thread.run(Thread.java:929)

@Daavidaviid glad you figured it out! If you don’t mind sharing, can you say what JS code was causing the crash?

@mrousavy Check your android gradle plugin version. For me after changing targetSdkVersion to 28 and soloader to 0.9.0 this worked

classpath 'com.android.tools.build:gradle:3.6.0' //Had to bump from 3.5.3 (RN 0.63.2's version) to 3.6.0 to make metro minifier config work, who knows why

but this failed

classpath 'com.android.tools.build:gradle:4.1.0-rc01'

I was attempting to use gradle plugin 4.1.0 per the instructions from the play console beta to include debug symbols in the app but clearly it’s different enough from 3.6 that it causes issues.