How to add custom library to Android application?

  • Hi,

    I am developing a movile application using Qt 5.14.1 for Android and the application crashes on startup when running the arm64-v8a abi. It works fine if I run the armeabi-v7a abi on the same device, but I need to make it work with the 64 bits version. The error is the following one:

    E vndksupport: Could not load vendor/lib64/egl/ from sphal namespace: dlopen failed: library "vendor/lib64/egl/" not found.

    I think it has to do with the fact that Since Android 7.0 it's not possible anymore to link against a non-ndk shared library (but I don't understand why it works with the armeabi-v7a abi).

    Anyway, I have tried different ways to include the library into the apk but I am not able to solve the problem. Anyone can help me?


  • Moderators

    You can use ANDROID_EXTRA_LIBS variable in .pro file to link additional libraries. It works for all architectures.

  • @sierdzio I've already done it and the library is included into the libs folder of the android build, but not into the apk.

  • Moderators

    No idea then, it works for me (with OpenSSL, protobuf and yaml-cpp libs). Perhaps your AndroidManifest is outdated? Or you replace ANDROID_EXTRA_LIBS value somewhere else (Qt Creator sometimes appends empty call to extra libs in main .pro file)?

  • OK, now I can add the library into the apk. The problem was that I didn't have the 64 bit version of the library. However, I am still getting the error because the application keeps looking for the library on the "vendor/lib64/egl/" folder. Is there any way to modify this and use the library file I am installing with the apk?

  • Moderators

    I don't know.

Log in to reply