facebook / SoLoader

Native code loader for Android
Apache License 2.0
1.34k stars 176 forks source link

SoLoader 0.8.0 couldn't find DSO to load - issue on .apk build #55

Open xserxses opened 4 years ago

xserxses commented 4 years ago

MyApp is crashing while performing tests on Firebase Test lab emulators (x86). Downgrading to 0.6.1 is fixing the problem.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libyoga.so caused by: APK was built for a different platform
    at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
    at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
    at com.facebook.yoga.YogaNative.<clinit>(YogaNative.java:15)
    at com.facebook.yoga.YogaConfig.<init>(YogaConfig.java:20)
    at com.facebook.yoga.YogaConfigFactory.create(YogaConfigFactory.java:5)
    at com.facebook.litho.yoga.LithoYogaFactory.createYogaConfig(LithoYogaFactory.java:26)
    at com.facebook.litho.NodeConfig.<clinit>(NodeConfig.java:45)
mars-lan commented 4 years ago

Seeing a similar issue on 0.8.0 with a different stack trace.

2019-12-26 11:43:06.860 14603-14619/? W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.awesomeproject/lib-main/libc++_shared.so" has unexpected e_machine: 40 (EM_ARM)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at java.lang.Runtime.load0(Runtime.java:928)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at java.lang.System.load(System.java:1633)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader$1.load(SoLoader.java:393)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:77)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:587)
2019-12-26 11:43:06.861 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:111)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:587)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:111)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.v8.reactexecutor.V8Executor.<clinit>(V8Executor.java:16)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.v8.reactexecutor.V8ExecutorFactory.create(V8ExecutorFactory.java:17)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
2019-12-26 11:43:06.862 14603-14619/? W/System.err:     at java.lang.Thread.run(Thread.java:764)
2019-12-26 11:43:06.863 14603-14619/? E/SoLoader: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.awesomeproject/lib-main/libc++_shared.so" has unexpected e_machine: 40 (EM_ARM)
2019-12-26 11:43:06.864 14603-14619/? W/System.err: com.facebook.soloader.SoLoader$WrongAbiError: APK was built for a different platform
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:645)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:587)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:111)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:587)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:111)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
2019-12-26 11:43:06.864 14603-14619/? W/System.err:     at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.v8.reactexecutor.V8Executor.<clinit>(V8Executor.java:16)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.v8.reactexecutor.V8ExecutorFactory.create(V8ExecutorFactory.java:17)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at java.lang.Thread.run(Thread.java:764)
2019-12-26 11:43:06.865 14603-14619/? W/System.err: Caused by: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.awesomeproject/lib-main/libc++_shared.so" has unexpected e_machine: 40 (EM_ARM)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.865 14603-14619/? W/System.err:     ... 18 more
2019-12-26 11:43:06.865 14603-14619/? E/SoLoader: couldn't find DSO to load: libfb.so caused by: APK was built for a different platform
2019-12-26 11:43:06.866 14603-14619/? W/System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfb.so caused by: APK was built for a different platform
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:587)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:111)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
2019-12-26 11:43:06.866 14603-14619/? W/System.err:     at com.facebook.v8.reactexecutor.V8Executor.<clinit>(V8Executor.java:16)
2019-12-26 11:43:06.867 14603-14619/? W/System.err:     at com.facebook.v8.reactexecutor.V8ExecutorFactory.create(V8ExecutorFactory.java:17)
2019-12-26 11:43:06.867 14603-14619/? W/System.err:     at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
2019-12-26 11:43:06.867 14603-14619/? W/System.err:     at java.lang.Thread.run(Thread.java:764)
2019-12-26 11:43:06.867 14603-14619/? E/SoLoader: couldn't find DSO to load: libv8executor.so caused by: couldn't find DSO to load: libfb.so caused by: APK was built for a different platform

    --------- beginning of crash
2019-12-26 11:43:06.868 14603-14619/? E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.awesomeproject, PID: 14603
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libv8executor.so caused by: couldn't find DSO to load: libfb.so caused by: APK was built for a different platform
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
        at com.facebook.v8.reactexecutor.V8Executor.<clinit>(V8Executor.java:16)
        at com.facebook.v8.reactexecutor.V8ExecutorFactory.create(V8ExecutorFactory.java:17)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
        at java.lang.Thread.run(Thread.java:764)

Was able to reproduce this reliably by applying the following patch to the standard RN starter project on a stock "Google Play Intel x86 Atom System Image API 28 rev 9" emulator.

--- build.gradle    2019-12-26 11:52:32.000000000 -0800
+++ build.gradle.original   2019-12-26 11:52:04.000000000 -0800
@@ -191,12 +191,6 @@
     }
 }

-configurations.all {
-     resolutionStrategy {
-       force "com.facebook.soloader:soloader:0.8.0"
-     }
-}
-
 // 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) {

Also attached a a copy of the project to help debug.

BurntBrunch commented 4 years ago

Hi, sorry about the delay! I've investigated this a bit and I am reasonably convinced that particular emulator image (Pie SDK 28 Google APIs x86) is just broken.

The Google APIs version is reporting both x86 and armv7 compatibility when the non-Google version correctly only reports x86. As a workaround, can you try using an SDK 29 (Q) Google APIs image? In my testing, that image should behave better.

I've also posted this on the Android bug tracker here.

mars-lan commented 4 years ago

@BurntBrunch thanks for looking into this. Actually it seems that the "brokenness" affects real devices as well. Seeing similar crashes in production on these devices running Android 6-9

Nexus 6 Xiaomi Mi 9X, Redmi Pro, Mi 5 Trend TaintArt for x86 X9 (Maybe Vivo X9?) Vivo s1 Huawei Enjoy 9s Others (Samsung, Asus, LGE, Google, Lenovo)

Unfortunately the stack trace from Firebase is limited

Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libv8executor.so

com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:789)
com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:639)
com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:577)
com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:525)
com.facebook.v8.reactexecutor.V8Executor.<clinit> (V8Executor.java:16)
com.facebook.v8.reactexecutor.V8ExecutorFactory.create (V8ExecutorFactory.java:17)
com.facebook.react.ReactInstanceManager$5.run (ReactInstanceManager.java:952)
java.lang.Thread.run (Thread.java:761)
xserxses commented 4 years ago

Update: Downgrading to 0.6.1 didn't fix the problem. After releasing it to production we faced some crashes from Sony devices.

Xperia XZ 33% Xperia X Compact 29% Xperia X 17% Xperia X Performance 14% Xperia XA 5% Xperia Z5 Compact 1% Xperia Z5 1%

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libyoga.so caused by: couldn't find DSO to load: libfb.so caused by: Error: Cannot load /data/user/0/com.mypackagi/lib-main/libfb.so
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName + 774(SoLoader.java:774)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName + 627(SoLoader.java:627)
       at com.facebook.soloader.SoLoader.loadLibrary + 565(SoLoader.java:565)
       at com.facebook.soloader.SoLoader.loadLibrary + 513(SoLoader.java:513)
       at com.facebook.yoga.YogaNative.<clinit> + 15(YogaNative.java:15)
       at com.facebook.yoga.YogaNative.jni_YGConfigNew(YogaNative.java)
       at com.facebook.yoga.YogaConfig.<init> + 20(YogaConfig.java:20)
       at com.facebook.yoga.YogaConfigFactory.create + 5(YogaConfigFactory.java:5)
       at com.facebook.litho.yoga.LithoYogaFactory.createYogaConfig + 26(LithoYogaFactory.java:26)
       at com.facebook.litho.NodeConfig.<clinit> + 45(NodeConfig.java:45)
       at com.facebook.litho.NodeConfig.getYogaConfig + 66(NodeConfig.java:66)
BurntBrunch commented 4 years ago

Google are reporting that the image is actually correct because there's runtime dynamic code translation in that image.

I have some thoughts on how to fix all this but it's not trivial, especially because I don't know what SELinux will let me do. Stay tuned.

mars-lan commented 4 years ago

Thanks for the investigation, @BurntBrunch. Look forward to a new release that includes https://github.com/facebook/SoLoader/commit/20198bf2952ca7e182d7e5764e33e931f9533554

BurntBrunch commented 4 years ago

@mars-lan this commit addressed the issue described, as it pertains to emulators. I don't think the other samples you saw are the same issue. I've added extended logging in the exception message for the WrongAbiError exceptions, hope that gives more clues.

mars-lan commented 4 years ago

@BurntBrunch is dynamic code translation limited to only emulators?

BurntBrunch commented 4 years ago

As far as I know, yes. x86 devices are very rare in the wild (they have libhoudini which does similar things on them) and all the devices you mentioned are definitely ARM.

mars-lan commented 4 years ago

Got it. Let's see if the extra logging can reveal some other bugs then. Look forward to the new release soon.

oprisnik commented 4 years ago

Version 0.8.1 has been released which includes this fix.

sintylapse commented 4 years ago

Still an issue for me with version 0.8.1, only error message a little bit changed in crashlitics couldn't find DSO to load: libhermes.so result: 0 instead of couldn't find DSO to load: libhermes.so

xserxses commented 4 years ago

Happening to me as well on production on version 0.8.1 of SoLoader. Xperia X Performance - Android 8.0.0

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libyoga.so caused by: couldn't find DSO to load: libfb.so caused by: Error: Cannot load /data/user/0/com.mypackage/lib-main/libfb.so result: 0 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.yoga.YogaNative.<clinit>(YogaNative.java:15)
       at com.facebook.yoga.YogaNative.jni_YGConfigNew(YogaNative.java)
       at com.facebook.yoga.YogaConfig.<init>(YogaConfig.java:20)
       at com.facebook.yoga.YogaConfigFactory.create(YogaConfigFactory.java:5)
       at com.facebook.litho.yoga.LithoYogaFactory.createYogaConfig(LithoYogaFactory.java:26)
       at com.facebook.litho.NodeConfig.<clinit>(NodeConfig.java:45)
       at com.facebook.litho.NodeConfig.getYogaConfig(NodeConfig.java:66)
xserxses commented 4 years ago

@BurntBrunch any updates on this?

mars-lan commented 4 years ago

Still seeing similar issue with SoLoader 0.8.2 with the following (not very helpful) error message. @BurntBrunch any update?

Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libv8executor.so result: 0
com.facebook.soloader.SoLoader.doLoadLibraryBySoName
bigggge commented 4 years ago

Have the same issue with React Native 0.61.5 and SoLoader 0.8.0 Device: Galaxy J2 Prime ,Redmi Note 4, HUAWEI Y3II

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
       at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27)
       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
       at java.lang.Thread.run(Thread.java:818)
vajid-khan commented 4 years ago

I am facing similar issue when I set enableSeparateBuildPerCPUArchitecture = true & enableProguardInReleaseBuilds = true in build.grade file. with above setting set to false, release apk works fine but I need to set it to true to decrease bundle size

I am testing it on a real device, Oneplus 7 running android 10 react: "16.11.0", react-native: "0.62.0"

ADB logcat

SoLoader: couldn't find DSO to load: libfbjni.so caused by: com.facebook.jni.NativeRunnable 05-05 10:09:05.304 4646 4677 E AndroidRuntime: FATAL EXCEPTION: create_react_context 05-05 10:09:05.304 4646 4677 E AndroidRuntime: Process: com.my_app, PID: 4646 05-05 10:09:05.304 4646 4677 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfbjni.so caused by: com.facebook.jni.NativeRunnable 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:325) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:104) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:108) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:1) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.soloader.j.a(Unknown Source:0) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.soloader.o.a.a(Unknown Source:10) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.jni.HybridData.(Unknown Source:2) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.react.bridge.WritableNativeMap.initHybrid(Native Method) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.react.bridge.WritableNativeMap.(Unknown Source:0) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.react.jscexecutor.a.create(Unknown Source:2) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at com.facebook.react.q$e.run(Unknown Source:58) 05-05 10:09:05.304 4646 4677 E AndroidRuntime: at java.lang.Thread.run(Thread.java:919)

yeshmesh commented 4 years ago

@BurntBrunch Thnx a lot dude, i had an API version 28 then i downloaded 29. It worked. Was spending 2 days figuring this out. Thank you again!

mars-lan commented 4 years ago

Still seeing similar issue with SoLoader 0.8.2 with the following (not very helpful) error message. @BurntBrunch any update?

Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libv8executor.so result: 0
com.facebook.soloader.SoLoader.doLoadLibraryBySoName

@BurntBrunch looks like the error code 0 corresponds to LOAD_RESULT_NOT_FOUND (https://github.com/facebook/SoLoader/blob/master/java/com/facebook/soloader/SoSource.java#L28). Are you able to shed some light here?

soroushm commented 4 years ago

same here on upgrade react-native to 62.2

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
       at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
       at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
       at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
       at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java)
       at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java)
       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java)
       at java.lang.Thread.run(Thread.java:818)
abhishekdewan101 commented 4 years ago

Not sure if this will work with all the apps out there but in the case of my app I figured that the /data/app// dir has all the so's already present ready to be used and all our SoLoader.init was doing was backing them up to lib-main ( for some reason the copying corrupts the files or makes them unusable) so the solution was in to initialize SoLoader in the mode where it doesn't back up the so's to the lib-main folder by providing SoLoader.init(context, SOLOADER_DISABLE_BACKUP_SOSOURCE) in application onCreate() (or where ever is more suitable). This way we never get a libs-main folder in your application directory and since SoLoader already has an idea of looking into /data/app// dir it works from them :) Again not sure if this is the right way to handle this but is a workaround :(

greg7gkb commented 4 years ago

SOLOADER_DISABLE_BACKUP_SOSOURCE change did not resolve this for my case (RN 61.5, target API 29)

soroushm commented 4 years ago

go to the android directory and run dis command "./gradle clean" its work for me

vpeeee commented 4 years ago

去掉defaultConfig里面的 ndk 在外面加上以下代码: splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } }

亲测有效, 不知道为啥

approached commented 4 years ago

What fixed it for us what upgrading the SOLoader.

In android/app/build.gradle:

dependencies {
   implementation 'com.facebook.soloader:soloader:0.9.0+'
mars-lan commented 4 years ago

Rolling 0.9.0 to production and haven't seen any crash so far. Hoping this is fixed by https://github.com/facebook/SoLoader/commit/3311e1ab34d4a7abdd681e33682a5fe700c0feac.

mars-lan commented 4 years ago

Definitely seeing fewer crashes with 0.9.0 but still not zero. Good news is that it's giving more logs now. Below is an example for Nexus 6. Looks like it's still trying to load from an incorrect location.

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libv8executor.so
    SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.invisatime/lib-main flags = 1]
    SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.invisatime-1/lib/arm flags = 0]
    SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2]
    SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
    Native lib dir: /data/app/com.invisatime-1/lib/arm
 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.v8.reactexecutor.V8Executor.<clinit>(V8Executor.java:16)
       at com.facebook.v8.reactexecutor.V8ExecutorFactory.create(V8ExecutorFactory.java:20)
       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:997)
       at java.lang.Thread.run(Thread.java:761)
thanakij commented 4 years ago

Hi @BurntBrunch, this is another one to help you with the debugging.

Version:

Distribution: Android App Bundle (AAB)

Device: Galaxy S5 (Android 5.1.1)

Log:

Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libhermes.so
SoSource 0: e.f.z0.a[root = /data/data/com.?/lib-main flags = 1]
SoSource 1: e.f.z0.c[root = /data/app/com.?-1/lib/x86 flags = 0]
SoSource 2: e.f.z0.c[root = /system/vendor/lib flags = 2]
SoSource 3: e.f.z0.c[root = /system/lib flags = 2]
Native lib dir: /data/app/com.?-1/lib/x86 result: 0
com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:896)
com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl (SoLoader.java:725)
com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:649)
com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:629)
com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:577)
com.facebook.hermes.reactexecutor.HermesExecutor.<clinit> (HermesExecutor.java:20)
com.facebook.hermes.reactexecutor.HermesExecutorFactory.create (HermesExecutorFactory.java:29)
com.facebook.react.ReactInstanceManager$5.run (ReactInstanceManager.java:997)
mightyorange commented 4 years ago

go to the android directory and run dis command "./gradle clean" its work for me

@soroushm Thanks. Is it ./gradlew clean ? ---> This command fixed the issue on my side...

slavikdenis commented 4 years ago

Hope more data helps.

Setup:

Distribution: Android App Bundle (AAB)

Device: Nexus 5X (Android 6.0.1)

Log:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
    SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.metropolis/lib-main flags = 1]
    SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.metropolis-1/lib/arm flags = 0]
    SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2]
    SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
    Native lib dir: /data/app/com.metropolis-1/lib/arm
 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.<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:818)

I'm gonna try this workaround for the next production build https://github.com/facebook/SoLoader/issues/59#issuecomment-669161376

pratheepkanati commented 4 years ago

if you using proguard try this rule's worked for me -keep class com.facebook.soloader.{*;} -keep class com.facebook.yoga.*{;} -keep class com.facebook.jni.{*;} -keep class com.facebook.fbjni.*{;}

NetPumi2 commented 4 years ago

go to the android directory and run dis command "./gradle clean" its work for me

@soroushm Thanks. Is it ./gradlew clean ? ---> This command fixed the issue on my side...

I do this command before every release and I still have this issue on production

NetPumi2 commented 4 years ago

Some more data from me

Setup:

"react-native": "0.63.0" implementation 'com.facebook.soloader:soloader:0.9.0+' enableHermes: false Distribution: Android App Bundle (AAB)

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
    SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/se.myApp.myApp/lib-main flags = 1]
    SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/se.myApp.myApp-1/lib/arm flags = 0]
    SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2]
    SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
    Native lib dir: /data/app/se.myApp.myApp-1/lib/arm
 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.<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:818)
Poojapandey89 commented 4 years ago

Any luck for the issue? Have tried multiple solutions but still facing it. The same issue is causing number of crashes in production app. "react-native": "0.63.0" implementation 'com.facebook.soloader:soloader:0.9.0+'

syrakozz commented 4 years ago

cd android && ./gradlew clean

This is worked for me

Daavidaviid commented 4 years ago

Me too.

Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libhermes.so SoSource 0: com.facebook.soloader.ApkSoSource

I'm using soloader 0.9.0+ and it happened since the update to 0.63.2.

It happened on devices with Android 10 and 11. Don't know why tho.

charleston10 commented 4 years ago

I'm a native android programmer, and this problem happens when compiling the app through Play from the android studio itself

Behind it, it generates an apk with ABI with simpler architecture for the OS

If you generate the APK via Build or via ADB, the APK architecture will be generated using the architecture defined by build.gradle or the standard architecture

In this case I want to make it clear, that there is a difference between creating apk via Play and via Build / ADB

RodolfoGS commented 3 years ago

@charleston10 Interesting, Thank you so much for your tips! And Do you know what could we do to fix this issue?

charleston10 commented 3 years ago

@charleston10 Interesting, Thank you so much for your tips! And Do you know what could we do to fix this issue?

I believe it is not a problem in the RN, but in how the android studio behaves in generating an apk

you can fix it, but I wouldn’t put much effort into it, since it’s a way the tool works

one of the alternatives and force the type of the build setting to ABI for the same architecture as RN

ABI - Application Binary Interface See https://developer.android.com/studio/build/configure-apk-splits

khaishien commented 3 years ago

i managed to resolve this crash by releasing apk instead of aab for playstore.

version for the production app "react-native": "0.61.5" force 'com.facebook.soloader:soloader:0.9.0'

it should be an issue on how bundletool manage the native library with the aab package while install into devices through playstore.

thanakij commented 3 years ago

Another one from me, but this time I have updated SoLoader to the latest version (0.10.1).

Version:

Device: Pixel 3 XL (Android 9)

Log:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
    SoSource 0: e.f.y0.a[root = /data/data/com.?/lib-main flags = 1]
    SoSource 1: e.f.y0.c[root = /data/app/com.?-QVmp1vNO5-Hi12o_PNJV0w==/lib/arm64 flags = 0]
    SoSource 2: e.f.y0.c[root = /vendor/lib64 flags = 2]
    SoSource 3: e.f.y0.c[root = /system/lib64 flags = 2]
    Native lib dir: /data/app/com.?-QVmp1vNO5-Hi12o_PNJV0w==/lib/arm64
 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582)
       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:997)
       at java.lang.Thread.run(Thread.java:764)
saczuac commented 3 years ago

Same issue here, with:

Setup:

"react-native": "0.63.2" implementation 'com.facebook.soloader:soloader:0.9.0+' enableHermes: false Distribution: Android App Bundle (AAB)

Device: Nexus 5X (Android 6.0.1)

Log:

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.metropolis/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.metropolis-1/lib/arm flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2] Native lib dir: /data/app/com.metropolis-1/lib/arm 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.(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:818)

velevtzvetlin commented 3 years ago

@saczuac does this fix it for you? It did for me:

configurations.all {
  resolutionStrategy {
    force "com.facebook.soloader:soloader:0.8.2"
  }
}
Prernabudh commented 3 years ago

@saczuac does this fix it for you? It did for me:

configurations.all {
  resolutionStrategy {
    force "com.facebook.soloader:soloader:0.8.2"
  }
}

With which version of React native did this work for you?

leofolive commented 3 years ago

How to reproduce this issue in emulator?

ghasemikasra39 commented 3 years ago

Same here:

Version:

"react-native": "0.64.1"
implementation 'com.facebook.soloader:soloader:0.10.1'
enableHermes: true
E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: one.realnote.app, PID: 15083
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/one.realnote.app/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/one.realnote.app-DyBwcPq-Y_Q92-gHnKVpLA==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        Native lib dir: /data/app/one.realnote.app-DyBwcPq-Y_Q92-gHnKVpLA==/lib/arm64
     result: 0 result: 0
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
        at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582)
        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:1024)
        at java.lang.Thread.run(Thread.java:929)
     Caused by: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjsi.so
        SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/one.realnote.app/lib-main flags = 1]
        SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/one.realnote.app-DyBwcPq-Y_Q92-gHnKVpLA==/lib/arm64 flags = 0]
        SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
        SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
        Native lib dir: /data/app/one.realnote.app-DyBwcPq-Y_Q92-gHnKVpLA==/lib/arm64
     result: 0
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
        at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:640)
        at com.facebook.soloader.DirectorySoSource.loadDependencies(DirectorySoSource.java:121)
        at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
        at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:477)
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:860)
            ... 8 more
ghasemikasra39 commented 3 years ago

@saczuac does this fix it for you? It did for me:

configurations.all {
  resolutionStrategy {
    force "com.facebook.soloader:soloader:0.8.2"
  }
}

Did not help for me.

roots-ai commented 3 years ago

I'm a native android programmer, and this problem happens when compiling the app through Play from the android studio itself

Behind it, it generates an apk with ABI with simpler architecture for the OS

If you generate the APK via Build or via ADB, the APK architecture will be generated using the architecture defined by build.gradle or the standard architecture

In this case I want to make it clear, that there is a difference between creating apk via Play and via Build / ADB

@charleston10 Can you please elaborate on what settings to keep in app/build.gradle to make this work?

Happening in RN 0.65 as well, without Android Studio. https://github.com/facebook/react-native/issues/32245

agrass commented 3 years ago

Hello! this error still with the configuration SoLoader 0.9+ when using RN 59. Anyone already managed to fix this issue? Thanks

java.lang.UnsatisfiedLinkErrorSoLoader.java:896
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libv8executor.so
    SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.app/lib-main flags = 1]
    SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.app-1/lib/arm flags = 0]
    SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2]
    SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
    Native lib dir: /data/app/com.app-1/lib/arm
RodolfoGS commented 3 years ago

@agrass I'm not sure, but maybe it will be fixed in this PR https://github.com/facebook/react-native/pull/30749 recently merged 🤞