question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Increasing minSdkVersion result in "couldn't find DSO to load: libhermes.so" (Hermes is disabled)

See original GitHub issue

Summary

  1. Init new expo project
  2. Install expo-dev-client
  3. Increase minSdkVersion to 23 (or higher)
  4. Run android

Expected: App launches successfully Actual: App crashes with “couldn’t find DSO to load: libhermes.so”

! Cannot reproduce it on expo sdk below 45 ! Cannot reproduce it with minSdkVersion below 23

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android

Package versions

expo: 45.0.0 (and above) expo-dev-client: 0.9.5 expo-cli: 5.4.3

Environment

expo-env-info 1.0.3 environment info:     System:       OS: macOS 12.3.1       Shell: 5.8 - /bin/zsh     Binaries:       Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node       Yarn: 1.22.17 - /opt/homebrew/bin/yarn       npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm     Managers:       CocoaPods: 1.11.3 - /opt/homebrew/bin/pod     SDKs:       iOS SDK:         Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5     IDEs:       Android Studio: 2021.1 AI-211.7628.21.2111.8139111       Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild     npmPackages:       expo: ~45.0.0 => 45.0.3       react: 17.0.2 => 17.0.2       react-dom: 17.0.2 => 17.0.2       react-native: 0.68.2 => 0.68.2       react-native-web: 0.17.7 => 0.17.7     npmGlobalPackages:       eas-cli: 0.52.0       expo-cli: 5.4.3     Expo Workflow: bare

Reproducible demo

  1. expo init repro (Choose “Bare”)
  2. cd repro
  3. expo run:android (Confirm it’s working)
  4. yarn add expo-dev-client
  5. In android/build.gradle change “minSdkVersion” to 23 (or higher)
  6. expo run:android

The only change I’ve made: build.gradle.txt

Stacktrace (if a crash is involved)

Emulator:

couldn’t find DSO to load: libhermes.so SoSource 0: com.facebook.soloader.DirectorySoSource/root =/data/app/_Nu-VQEApH6ceehdAR6F6A==/ com.repro-ruyBOYzemz5NfvtXev8gmw==/lib/ arm64 flags = 0) SoSource 1: com.facebook.soloader.DirectApkSoSource[root =/data/app/_Nu-VQEApH6ceehdAR6F6A==/ com.repro-ruyBQYzemz5NfvtXev&gmw==/ base.apk!/lib/arm64-v8al SoSource 2: com.facebook.soloader.DirectorySoSource root =/system/lib64 flags = 21 SoSource 3: com.facebook.soloader. DirectorySoSource/root =/vendor/lib64 flags = 21 Native lib dir: /data/app/ ~~_Nu-VQEApH6ceehdAR6F6A==/ com.repro-ruyBOYzemz5NfvtXev8gmw==/lib/ arm64 result: 0

ADB:

15830 15830 D CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10152; state: ENABLED 361 408 D goldfish-address-space: claimShared: Ask to claim region [0x1f159c000 0x1f1f04000] 361 408 D goldfish-address-space: claimShared: Ask to claim region [0x1f1f04000 0x1f286c000] 361 408 D goldfish-address-space: claimShared: Ask to claim region [0x1f4000000 0x1f4968000] 544 559 I ActivityTaskManager: Displayed com.repro/expo.modules.devlauncher.launcher.errors.DevLauncherErrorActivity: +556ms 714 830 D EGL_emulation: app_time_stats: avg=10007.88ms min=10007.88ms max=10007.88ms count=1 544 1604 W InputManager-JNI: Input channel object ‘be06ef7 com.repro/expo.modules.devlauncher.launcher.DevLauncherActivity (client)’ was disposed without first being removed with the input manager! 544 1604 W InputManager-JNI: Input channel object ‘6ab9eff com.repro/com.repro.MainActivity (client)’ was disposed without first being removed with the input manager! 1353 1353 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3269 1353 1353 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1947 1353 1353 I DeviceUnlockedTag: DeviceUnlockedTag.notifyDeviceLockStatusChanged():79 Notify device unlocked. 397 397 W SurfaceFlinger: couldn’t log to binary event log: overflow. 544 1604 W InputManager-JNI: Input channel object ‘c14c71a Splash Screen com.repro (client)’ was disposed without first being removed with the input manager! 714 830 D EGL_emulation: app_time_stats: avg=15.33ms min=0.97ms max=34.54ms count=54 15830 15857 D SoLoader: libreactnativejni.so not found on /data/app/~~_Nu-VQEApH6ceehdAR6F6A==/com.repro-ruyB0Yzemz5NfvtXev8gmw==/lib/arm64 15830 15857 D SoLoader: libreactnativejni.so found on DirectAPKSoSource: 4 15830 15873 D EGL_emulation: app_time_stats: avg=134.19ms min=1.73ms max=1441.09ms count=11 714 830 D EGL_emulation: app_time_stats: avg=19.14ms min=1.08ms max=101.37ms count=38 1024 1797 E ActivityThread: Failed to find provider info for com.google.android.apps.wellbeing.api 373 373 E android.hardware.power.stats@1.0-service-mock: Failed to getEnergyData 1024 1797 E ActivityThread: Failed to find provider info for com.google.android.apps.wellbeing.api

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
gdogarucommented, May 12, 2022

try to add this to app/build.gradle

android{
...
packagingOptions {
     jniLibs.useLegacyPackaging = true
}
...
}
9reactions
gyl89commented, Sep 15, 2022

Same issue with the manage workflow. I tried to use the workaround by adding a packagingOptions with “expo-build-properties”, without success. Relevant code of app.config.ts:

[
     'expo-build-properties',
     {
       'android': {
         'minSdkVersion': 24,
         'packagingOptions':{
           'jniLibs': {
             'useLegacyPackaging':true
           }
         }
       }
     }
   ]

I guess that it’s a bug in the plugin which does not seem to consider jniLibsas a possible option to be added to packagingOptions. The relevant part of the build.gradefile after expo prebuildis

["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
    // Split option: 'foo,bar' -> ['foo', 'bar']
    def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
    // Trim all elements in place.
    for (i in 0..<options.size()) options[i] = options[i].trim();
    // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
    options -= ""

    if (options.length > 0) {
        println "android.packagingOptions.$prop += $options ($options.length)"
        // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
        options.each {
            android.packagingOptions[prop] += it
        }
    }
}

So my solution was to create an expo plugin that adds a line to build.gradle. Namely:

const { createRunOncePlugin, withAppBuildGradle } = require('@expo/config-plugins');

const withAppBuildGradleModified = config => {
  return withAppBuildGradle(config, async file => {
    const modResults = file.modResults;
    modResults.contents = modResults.contents + '\nandroid.packagingOptions.jniLibs.useLegacyPackaging = true\n';
    return file;
  });
};




module.exports = createRunOncePlugin(
  withAppBuildGradleModified,
  'withAppBuildGradleMOdified',
  '1.0.0'
);

This solution seemed to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native :java.lang.UnsatisfiedLinkError: couldn't find ...
In my case I needed to add hermes path for each android flavour ... ext { buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion ......
Read more >
App fixes flagged on Firebase Crashylitics - Mon 4th Jan, 2020
UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so ... For now, I have disabled Hermes until I can update React Native versions, ...
Read more >
[Solved]-React-Native :java.lang.UnsatisfiedLinkError: couldn't ...
Coding example for the question React-Native :java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so-React Native.
Read more >
Newest 'react-native' Questions - Stack Overflow
UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so caused by: com.facebook.hermes.reactexecutor.HermesExecutor result: 0 This is ...
Read more >
Using Hermes Engine - Expo Documentation
Hermes is a JavaScript engine optimized for React Native. By compiling JavaScript into bytecode ahead of time, Hermes can improve your app start-up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found