This article explains how to import correctly the ssl libraries in Qt for Android with a multi-abi kit.
In my project the supported achitectures are armeabi-v7a and arm64-v8a, but the code below is working with all achitectures supported by Android.
Normally when I needed to import different libraries for a specific architecture I used something like this:
contains(ANDROID_TARGET_ARCH, arm64-v8a) {
ANDROID_EXTRA_LIBS += $$PWD/libs/arm64-v8a/library.so \
...
}
else:contains(ANDROID_TARGET_ARCH, armeabi-v7a) {
ANDROID_EXTRA_LIBS += $$PWD/libs/armeabi-v7a/library.so
...
}
In my experience with a multi-abi kit this solution doesn't work properly and 32 bit libraries are not included correctly in the final build.
The solution is simple, based on the ANDROID_ABIS that declares the achitectures supported in the .pro file of you project.
ANDROID_ABIS = armeabi-v7a arm64-v8a
The inclusion of the libraries must be done by cycling the supported abis and including the specific libraries for each target architecture.
for(abi, ANDROID_ABIS): ANDROID_EXTRA_LIBS += $$PWD/libs/$${abi}/libcrypto_1_1.so \
$$PWD/libs/$${abi}/libssl_1_1.so
As you can guess, the important thing is to name the library folders with the correct name of each specific architecture.
The alternative solution is by making a specific compilation for each specific abi, but this way takes longer and it is less convenient.
The libraries are available from this link:
https://github.com/KDAB/android_openssl
Download the project and choose the proper libraries depending on the Qt version you are using.