Detox: Tests fail with error "java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so"

What happened?

After upgrading react-native to version 0.68.2 from 0.63.4, the tests fail. The built application works. The error that is thrown by the tests is:

DetoxRuntimeError: Failed to run application on the device

    HINT: Most likely, your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.

      3 | describe('Example', () => {
      4 |   beforeAll(async () => {
    > 5 |     await device.launchApp()
        |                  ^
      6 |   })
      7 |

      at onboarding.e2e.ts:5:18
      at onboarding.e2e.ts:8:71
      at Object.<anonymous>.__awaiter (onboarding.e2e.ts:4:12)
      at Object.<anonymous> (onboarding.e2e.ts:4:24)

By reading the more detailed logs, we find that the following command causes an error:

13:13:09.324 detox[105379] DEBUG: [SPAWN_CMD, #27, cpid=105524] /home/user/Library/Android/sdk/platform-tools/adb -s emulator-14004 shell am instrument -w -r -e detoxServer ws://localhost:39081 -e detoxSessionId d6ae8bef-12df-0b4e-4336-c96d21b681d9 -e debug false com.revelator.originalworks.test/androidx.test.runner.AndroidJUnitRunner
13:13:10.443 detox[105379] DEBUG: [SPAWN_END, #27, cpid=105524] /home/user/Library/Android/sdk/platform-tools/adb -s emulator-14004 shell am instrument -w -r -e detoxServer ws://localhost:39081 -e detoxSessionId d6ae8bef-12df-0b4e-4336-c96d21b681d9 -e debug false com.revelator.originalworks.test/androidx.test.runner.AndroidJUnitRunner exited with code #0

adb shell output:

 detoxSessionId d6ae8bef-12df-0b4e-4336-c96d21b681d9 -e debug false com.revelator.originalworks.test/androidx.test.runner.AndroidJUnitRunner                                                                     <
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0

These are logs from adb logcat. This is the error part.

logs:
07-14 15:31:24.634 19982 19982 E SoLoader: couldn't find DSO to load: libhermes.so
07-14 15:31:24.634 19982 19982 E SoLoader: 	SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/~~uSoN9VPkk1WOrWDuOLHKBA==/com.revelator.originalworks-JByrEhVwC7zOOGW0bGmoXg==/lib/x86_64 flags = 0]
07-14 15:31:24.634 19982 19982 E SoLoader: 	SoSource 1: com.facebook.soloader.DirectApkSoSource[root = /data/app/~~_40r519kmaU-M2cpDflLfQ==/com.revelator.originalworks.test-iZJ33nB4_UiufyC2njdQTg==/base.apk!/lib/x86_64]
07-14 15:31:24.634 19982 19982 E SoLoader: 	SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
07-14 15:31:24.634 19982 19982 E SoLoader: 	SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
07-14 15:31:24.634 19982 19982 E SoLoader: 	Native lib dir: /data/app/~~uSoN9VPkk1WOrWDuOLHKBA==/com.revelator.originalworks-JByrEhVwC7zOOGW0bGmoXg==/lib/x86_64
07-14 15:31:24.634 19982 19982 E SoLoader:  result: 0
07-14 15:31:24.635 19982 19982 W System.err: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
07-14 15:31:24.635 19982 19982 W System.err: 	SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/~~uSoN9VPkk1WOrWDuOLHKBA==/com.revelator.originalworks-JByrEhVwC7zOOGW0bGmoXg==/lib/x86_64 flags = 0]
07-14 15:31:24.635 19982 19982 W System.err: 	SoSource 1: com.facebook.soloader.DirectApkSoSource[root = /data/app/~~_40r519kmaU-M2cpDflLfQ==/com.revelator.originalworks.test-iZJ33nB4_UiufyC2njdQTg==/base.apk!/lib/x86_64]
07-14 15:31:24.635 19982 19982 W System.err: 	SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
07-14 15:31:24.635 19982 19982 W System.err: 	SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
07-14 15:31:24.635 19982 19982 W System.err: 	Native lib dir: /data/app/~~uSoN9VPkk1WOrWDuOLHKBA==/com.revelator.originalworks-JByrEhVwC7zOOGW0bGmoXg==/lib/x86_64
07-14 15:31:24.635 19982 19982 W System.err:  result: 0
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:25)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:19)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:369)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:318)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:95)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.revelator.originalworks.MainApplication.onCreate(MainApplication.java:55)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
07-14 15:31:24.635 19982 19982 W System.err: 	at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:442)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.app.ActivityThread.access$1300(ActivityThread.java:237)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.os.Looper.loop(Looper.java:223)
07-14 15:31:24.635 19982 19982 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
07-14 15:31:24.635 19982 19982 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
07-14 15:31:24.635 19982 19982 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
07-14 15:31:24.635 19982 19982 D AndroidRuntime: Shutting down VM
07-14 15:31:24.636 19982 19982 E AndroidRuntime: FATAL EXCEPTION: main
07-14 15:31:24.636 19982 19982 E AndroidRuntime: Process: com.revelator.originalworks, PID: 19982
07-14 15:31:24.636 19982 19982 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/~~uSoN9VPkk1WOrWDuOLHKBA==/com.revelator.originalworks-JByrEhVwC7zOOGW0bGmoXg==/lib/x86_64 flags = 0]
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	SoSource 1: com.facebook.soloader.DirectApkSoSource[root = /data/app/~~_40r519kmaU-M2cpDflLfQ==/com.revelator.originalworks.test-iZJ33nB4_UiufyC2njdQTg==/base.apk!/lib/x86_64]
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	Native lib dir: /data/app/~~uSoN9VPkk1WOrWDuOLHKBA==/com.revelator.originalworks-JByrEhVwC7zOOGW0bGmoXg==/lib/x86_64
07-14 15:31:24.636 19982 19982 E AndroidRuntime:  result: 0
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.jscexecutor.JSCExecutor.loadLibrary(JSCExecutor.java:24)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:20)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.jscexecutor.JSCExecutor.loadLibrary(Unknown Source:0)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:351)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:318)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:95)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.revelator.originalworks.MainApplication.onCreate(MainApplication.java:55)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:442)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.app.ActivityThread.access$1300(ActivityThread.java:237)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:223)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
07-14 15:31:24.636 19982 19982 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
07-14 15:31:24.636 19982 19982 E AndroidJUnitRunner: An unhandled exception was thrown by the app.
07-14 15:31:24.638 19982 19982 E InstrumentationResultPrinter: Failed to mark test No Tests as finished after process crash
07-14 15:31:24.638 19982 19982 I AndroidJUnitRunner: Bringing down the entire Instrumentation process.

Setup ./android/build.gradle: https://pastebin.com/raw/kFP9SvkV ./android/app/build.gradle: https://pastebin.com/raw/AdYvm1tC DetoxTest.java: https://pastebin.com/raw/V8vZMt6E

What was the expected behaviour?

No response

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 19.6.9 React Native version: 0.68.2 Node version: 12.21 Device model: Nexus_5X_API_R Android version: 11 Test-runner (select one): jest+jasmine

Detox logs

https://pastebin.com/raw/2Z6s7bYj

Device logs

https://pastebin.com/raw/PHwrUEMY

More data, please!

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (5 by maintainers)

Most upvoted comments

oh, I’m so glad we’re not the only ones!

How strange. One of the first things I had tried last week was forcing Soloader to 0.10.3, but it didn’t seem to fix the issue.

However, forcing it to 0.10.4 solves the problem for me (see releases):

In my android/app/build.gradle:

dependencies {
    ...
    implementation 'com.facebook.soloader:soloader:0.10.4+'
    ....
}

There seem to be several complaints in the Soloader project, regarding this error appearing in 64-bit environments. I’m guessing all of us are using "system-images;android-30;default;x86_64" or similar for our AVDs?

Tried the soloader 0.10.4, and that changed the logcat a little. Now I can see a new error: image

But I honestly don’t know if this error is relevant or just a consequence of changing the soloader version.

Firstly i tried just to use specific version of soloader (0.10.4+) image , and that alone didn’t work for detox test build, because it was causing another error. Which, later, I solved by doing the following guide: https://wix.github.io/Detox/docs/introduction/android/#setting-detox-up-as-a-compiling-dependency

Thank you all

I’m in the same boat as you - same problem

fixing to implementation 'com.facebook.soloader:soloader:0.10.4+' fixed this for me

One last addition from me.

We’re upgrading a couple of RN projects at the moment and have stumbled across a lot of discussion about Soloader 0.10.3 causing issues in Android instrumented tests:

Good luck to all of you!

I’m guessing all of us are using “system-images;android-30;default;x86_64” or similar for our AVDs?

That’s exactly what we’re using.

That gives me an impression that the problem is coming from the test build used by detox.

I also think it’s caused by detox somehow. As Michał mentioned in description, the apk built with assembleRelease works fine. It’s only the apk built with assembleAndroidTest -DtestBuildType=debug that fails.