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

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~Q1vjL-Sbogpgp23q4KuiUA==/com.vastmindz-2Qq1zN8YfrsoxWIi-B5xZQ==/base.apk!/lib/arm64-v8a/libfolly_runtime.so"... #44553

Closed
sumitjainwegile opened this issue May 13, 2024 · 8 comments

Comments

@sumitjainwegile
Copy link

Description

I had an error when integrating a third-party Android .aar to my project.
Primarily I have tried on a RN 0.70.0 project and this working fine on RN 0.70.0 then I have created a new project with RN 0.73.0 and just linked the .aar files in libs folder then App Getting Crash while running.

Steps to reproduce

  1. Install node module with Yarn
  2. Then create build with and run project in android studio
  3. Its become Successful Build while creating a build
  4. Its crash the application immediately when install on mobile

React Native Version

0.73.0

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 13.5
  CPU: (8) arm64 Apple M1
  Memory: 101.86 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 9.6.7
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 21.4
      - iOS 16.0
      - macOS 12.3
      - tvOS 16.0
      - watchOS 9.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10227.8.2321.11479570
  Xcode:
    version: 14.0/14A309
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.0
    wanted: 0.73.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

FATAL EXCEPTION: main
                                                                                                    Process: com.vastmindz, PID: 18885
                                                                                                    java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~Q1vjL-Sbogpgp23q4KuiUA==/com.vastmindz-2Qq1zN8YfrsoxWIi-B5xZQ==/base.apk!/lib/arm64-v8a/libfolly_runtime.so"...
                                                                                                    	at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
                                                                                                    	at java.lang.Runtime.loadLibrary0(Runtime.java:998)
                                                                                                    	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.react.jscexecutor.JSCExecutor$Companion.loadLibrary(JSCExecutor.kt:31)
                                                                                                    	at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.kt:25)
                                                                                                    	at com.facebook.react.jscexecutor.JSCExecutor.loadLibrary(Unknown Source:0)
                                                                                                    	at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:387)
                                                                                                    	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.vastmindz.MainApplication.onCreate(MainApplication.kt:46)
                                                                                                    	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1225)
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7102)
                                                                                                    	at android.app.ActivityThread.access$1800(ActivityThread.java:259)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2208)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:233)
                                                                                                    	at android.os.Looper.loop(Looper.java:344)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8248)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)

Reproducer

#43126

Screenshots and Videos

https://github.com/facebook/react-native/assets/105035653/1296aa84-0ad2-4eeb-85e4-b12003996ce8
Screenshot 2024-05-13 at 6 09 11 PM

Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@github-actions github-actions bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels May 13, 2024
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@cortinico
Copy link
Contributor

This is a duplicate of a lot of similar issues that you can find here:
https://github.com/facebook/react-native/issues?q=is%3Aissue+sort%3Aupdated-desc+__emutls_get_address+is%3Aclosed

The problem is most likely a wrong version of the NDK you have in your setup.

@cortinico cortinico added Resolution: Duplicate and removed Needs: Triage 🔍 Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels May 14, 2024
@cortinico
Copy link
Contributor

I had an error when integrating a third-party Android .aar to my project.

You need to make sure you're using the same version of the NDK used to build the .aar you're importing (as I assume it contains native libraries)

@sumitjainwegile
Copy link
Author

sumitjainwegile commented May 14, 2024

@cortinico I have used same version of ndk but getting same issue
I have Compiled rppg_common-0.5.2 library with ndk version 23.1.7779620 and also add same version in build.gradle to run application

@efstathiosntonas
Copy link

Had this issue before, besides what cortinico stated above, this might be a gradle paths issue on your local setup.

Can you try this:

Go to Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle User Home on Android Studio,and change this path /Applications/Android Studio.app/Contents/jbr/Contents/Home instead to /Users//.gradle.

Note that using global gradle can cause issues down the road so use it with care.

@flyskywhy
Copy link
Contributor

No need to rebuild third-party .aar or .so, just patch:

cd tools/android-sdk/ndk

mv ./21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ./21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/origin_libc++_shared.so
cp ./23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ./21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/

as described in Patch to fix __emutls_get_address crash on Android

@wenchengshen
Copy link

@cortinico I need help. I'm encountering the same error and the same problem. Debugger and release mode are not working. It works normally on Android 10, and the NDK version and importing AAR packages are the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants