dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/lib/arm/libvlc.so"..
Description
Loading LibVlc instantly crashes my app, due to a linking error.
The full error message is the following:
VLC/LibVLC: Can't load vlcjni library: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/com.example.reactnativepartialplayer-MMVBRecKc2YRB74mLBVa9w==/lib/arm/libvlc.so"..
I have added the following to my build.gradle file to avoid other errors:
android {
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
Is there a specific setting needed to use libVLC in such a context?
Expected behavior
The library loads.
Actual behavior
The whole application crashes
Steps to reproduce
- Running the function below instantly crashes the app
Code you used
I'm making a react native module for Android in Kotlin. Here are minimal snippets:
class PartialPlayerModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
val _context = reactContext.applicationContext
...
@ReactMethod
fun vlc(uri: String, promise: Promise) {
try {
val vlc = LibVLC(_context) // crash
promise.resolve("ok")
} catch (e: Exception) {
e.printStackTrace()
promise.resolve(String.format("Catch: %s", e.message))
}
}
Screenshot / video
N/A
Context
libvlc version
implementation 'org.videolan.android:libvlc-all:3.3.10'
Android version
Android 10
Device model
Redmi 9C NFC