QT6.6 Java UnsatisfiedLinkError __emutls_get_address for libQt6Core_arm64-v8a.so
-
Hello,
I'm working on an android app that is made in Android Studio using Kotlin, but uses a dynamically linked libraray made in QT. This app & configuration was working without issue for Android 12 and QT 6.3, but now I'm migrating to Android 13 & QT6.6 and when I run the app it crashes with the following error:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~1PTtu2GzGNldomck9dgJ7w==/com.hillrom.servicetool-o6pav2vT60GZBI7KQGHAkg==/base.apk!/lib/arm64-v8a/libQt6Core_arm64-v8a.so"From what I gathered about this error, it usually occurs when there is a mismatch between the ndk being used and the ndk that QT supports. On the QT 6.6 mobile dev page it states that 6.6 supports android ndk 25b and has this note:
"Note: It's recommended that Qt user apps use the same NDK r25b version used for building these official Qt for Android libraries. An NDK version more recent than r23b is required if building a project results in an error of missing the symbols for __emutls_get_address."I'm using Android ndk 25b, but still getting this error. Does anyone know anything else that could cause this error?
Here is my build config for QT:
I also took a look in libQt6Core_arm64-v8a.so file, and I'm not very familiar with how a .so should be laid out, I do see several references to __emutls_get_address in it. So it seems I'm using the correct .so file.
-
Solved my own issue so I'll update in case anyone else runs into the same problem. Its a simple fix once you know what you're doing. You just need to force android studio to use the same ndk that you used to build your QT dynamic libraries.
In my app level gradle file I added the follow under android{}
ndkVersion = "25.1.8937393"