skip to Main Content

This started happening after we upgraded our compileSdkVersion and targetSdkVersion to 31.

To give some background: Our project is currently on react native 0.63.2 and previous compileSdkVersion was 30. We were successfully building android app till a few days back but suddenly it started to fail with the following error:

AAPT: error: resource android:attr/lStar not found

After some searching online, we followed some solutions here: Resource linking fails on lStar
. We upgraded to compileSdkVersion and targetSdkVersion to 31, did some other related changes
and were able to compile successfully. But the app is now crashing immediately on startup when I run it on Android 13 device. The following are the error logs from logcat:

2022-11-06 16:54:44.438 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found: needed by /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libjscexecutor.so in namespace classloader-namespace result: 0
2022-11-06 16:54:44.480 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZTVN6hermes2vm12CrashManagerE" referenced by "/data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libhermes-executor-debug.so"... result: 0
2022-11-06 16:54:44.482 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-release.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
     result: 0
2022-11-06 16:54:44.483 15842-15842/com.flyfinapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.flyfinapp, PID: 15842
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
     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.<clinit>(HermesExecutor.java:19)
        at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
        at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:369)
        at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
        at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
        at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
        at com.flyfinapp.MainApplication.onCreate(MainApplication.java:77)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2022-11-06 16:54:44.483 15842-15842/com.flyfinapp E/WebEngage: App has crashed
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
     result: 0
2022-11-06 16:54:47.669 15942-15942/com.flyfinapp E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found: needed by /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libjscexecutor.so in namespace classloader-namespace result: 0
2022-11-06 16:54:47.676 15942-15942/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZTVN6hermes2vm12CrashManagerE" referenced by "/data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libhermes-executor-debug.so"... result: 0
2022-11-06 16:54:47.678 15942-15942/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-release.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
     result: 0
2022-11-06 16:54:47.679 15942-15942/com.flyfinapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.flyfinapp, PID: 15942
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
     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.<clinit>(HermesExecutor.java:19)
        at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
        at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:369)
        at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
        at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
        at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
        at com.flyfinapp.MainApplication.onCreate(MainApplication.java:77)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2022-11-06 16:54:47.679 15942-15942/com.flyfinapp E/WebEngage: App has crashed
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
     result: 0

We have enableHermes set to true.
We also searched solutions for this but everything was applicable for RN 67 and beyond. But we are still on RN 63, so none of those solutions worked. We can try upgrading our RN version but there are some blockers so it is not possible to upgrade right away. For now we would like to solve this specific issue and move on. Any help here would be greatly appreciated.

7

Answers


  1. I recommend using fixed stable version of react native library if you are not using one, like below:

    def REACT_NATIVE_VERSION = "0.64.2" //replace this with the latest stable version you were using before
    
    allprojects {
        configurations.all {
            resolutionStrategy {
                force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
            }
        }
        repositories {
            google()
            ...
        }
    }
    

    Optionally, you may consider using dynamic value of REACT_NATIVE_VERSION from your package.json file with the following script:

    def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
    

    This will prevent your app from unexpected behaviours due to unstable versions, however, downside of this is you have to check for latest updates from react native library manually and update time to time.

    Login or Signup to reply.
  2. It seems related to a broken release on Maven.

    Here is the conversation about it: https://github.com/facebook/react-native/issues/35210

    @Ankur’s comment is the suggested workaround for RN >= 0.63

    Login or Signup to reply.
  3. The only thing that worked for me was disabling Hermes in app/build.gradle

    project.ext.react = [
        enableHermes: false,  // clean and rebuild if changing
    ]
    
    Login or Signup to reply.
  4. I was able to sort out exactly the same problem by setting proper values for hermesFlagsForVariant and deleteDebugFilesForVariant in your build.gradle. Make sure you specify the values that match your build variant name (e.g. beta, qa etc) https://github.com/facebook/react-native/issues/33177#issuecomment-1066604107. However, I’m using RN0.70.5, so not sure if it’d help in older versions

    Login or Signup to reply.
  5. After upgrading to React Native 0.69, replace the following lines in app/build.gradle:

    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
        
    

    With:

    implementation("com.facebook.react:hermes-engine:+") {
        exclude group:'com.facebook.fbjni'
    }
    

    On React Native 0.69, users will be consuming the Android multi-variant artifacts available inside the android/com/facebook/react/hermes-engine/ folder in the react-native NPM package: https://reactnative.dev/architecture/bundled-hermes#android-users.

    Login or Signup to reply.
  6. Removing flipper completely solved the issue:

    1. Delete it from packages.json
    2. Android folder -> app -> src -> main -> java -> com -> yourApp -> MainApplication.java, Search for "initializeFlipper" and delete it
    3. Android -> gradle.properties, Delete "FLIPPER_VERSION=0.138.0" line
    4. Android -> app -> build.gradle, Delete all line with "flipper"
    5. Delete android -> app -> src -> debug -> java ->com -> staffmatch ->ReactNativeFlipper.java
    Login or Signup to reply.
  7. As far as I understand, this issue is occuring due to incompatibility between the react-native and the hermes-engine version. Make sure that you are using the proper hermes version for [email protected]

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search