Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" lib/arm64-v8a/libfolly_runtime.so #42098

Closed
karshTensor opened this issue Dec 29, 2023 · 4 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library

Comments

@karshTensor
Copy link

Description

I am working on a project which is in React Native and also we are using Tuya SDK in android module and then using Native modules we will use android functionality in React native project.

When im running app on android api level below 30. basically below android R it successfully gets installed but above or on app level 30 it installs and crash with the error.
UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" lib/arm64-v8a/libfolly_runtime.so

Version
"react": "18.2.0", "react-native": "0.73.1"

Have done a lot of research around the same These two links may also show similar concern.

SoLoader Issue React Native Vision Camera

Stackoverflow

Steps to reproduce

Make sure you install app on or above api level 30 android device.

  1. Install the app using npm start
  2. When asked press "a" for android
  3. It'll crash immediately as soon as app launches

React Native Version

0.73.1

Affected Platforms

Runtime - Android

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: Windows 10 10.0.19045
  CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  Memory: 1.43 GB / 15.79 GB
Binaries:
  Node:
    version: 20.9.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 10.1.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-231.9392.1.2311.11076708
  Visual Studio: Not Found
Languages:
  Java: 11.0.20
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

java.lang.UnsatisfiedLinkError: 
dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~S-PiaWKTv9nikJX9p3KLVg==/com.mobidemo-
p4wbeDLIc2BzF4DLIOjF1g==/base.apk!/lib/arm64-v8a/libfolly_runtime.so"...

at java.lang.Runtime.loadLibrary0(Runtime.java:1082)
at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
at java.lang.System.loadLibrary(System.java:1661)
at com.facebook.soloader.nativeloader.SystemDelegate.loadLibrary(SystemDelegate.java:24)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:52)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:30)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:26)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:384)
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:326)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:98)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:43)
at com.mobidemo.MainApplication.onCreate(MainApplication.kt:47)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6997)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8176)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Reproducer

https://github.com/karshTensor/mobidemo/tree/main/ReproducerApp

Screenshots and Videos

No response

@cortinico
Copy link
Contributor

Duplicate of #40928 (comment)
and other similar issues.

The issue is caused by using a mixture of libraries which are not compiled using the right NDK. In this case I believe the Tuya SDK you mention is not compiled with NDK 25, therefore you have this crash.

I am working on a project which is in React Native and also we are using Tuya SDK in android module and then using Native modules we will use android functionality in React native project.

You should report this issue to them as there is nothing we can do to fix it.

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library and removed Needs: Triage 🔍 labels Jan 2, 2024
@lobaoblank
Copy link

@karshTensor I'm facing the same issue using Tuya SDK. Did you manage to solve it?

@karshTensor
Copy link
Author

@karshTensor I'm facing the same issue using Tuya SDK. Did you manage to solve it?

@lobaoblank

Partially Yes,

let me explain.
1 -> With the recent versions of React native when im trying to use TUYA SDK it causes the issue.
Regarding the same ive done alot of research and tried different solution but none of it worked.
Also, connected with TUYA team but they couldnt help me either.

At the end ive figured out something else which i can use until i find the perfect solution which can work with latest version of RN(React Native).

2 -> For now, ive downgraded the project to RN 0.70.14 which works well with latest TUYA SDK.
You can keep developing and once youve any significant solution you can again upgrade the project to latest version.

I hope this helps.
Or meanwhile if you find any other concrete solution please reach out.
karsh.soni@tensoriot.com

Regards,
Karsh Soni

@melo213
Copy link

melo213 commented Mar 5, 2024

Delete libc++_shared.so in the aar file in Tuya SDK, and then generate a new aar, which can solve the problem. The reason is that this .so is compiled inconsistently with the NDK that comes with RN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Answered When the issue is resolved with a simple answer Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library
Projects
None yet
Development

No branches or pull requests

4 participants