Solved compiling and adding openssl for QT android apk
-
Hey QTmasters anyone can help me with QT android openssl issue?
ISSUE:
QSslSocket::supportsSsl() return me false while running on android but on windows it is working fineI tried to use prebuilt openssl but still it is not working
also I tried to build openssl for QT android form this link
https://www.tal.org/tutorials/openssl_qt_androidstill issue has not resolved
CAn you help me with this?
Thanks in advance:) -
Is SSL linked and deployed? Do you get any warnings? Which Android version you test this on?
-
@sierdzio ssl link means add extra libraries in build android apk right?
I get this error:
library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.qtproject.example.Airtls-aXxH4nLGzc1Ll3UqvzQlWg==/lib/arm/libQt5Core.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.qtproject.example.Airtls-aXxH4nLGzc1Ll3UqvzQlWg==/lib/arm:/data/app/org.qtproject.example.Airtls-aXxH4nLGzc1Ll3UqvzQlWg==/base.apk!/lib/armeabi-v7a", permitted_paths="/data:/mnt/expand:/data/dataI am using Android version 10
-
Yes, SSL libraries have to be bundled together with your APK (also, remember about exports restrictions).
You have this done if you followed the second link you have shared:
contains(ANDROID_TARGET_ARCH,armeabi-v7a) { ANDROID_EXTRA_LIBS = \ $$PWD/3rdparty/openssl-armv7/libcrypto.so \ $$PWD/3rdparty/openssl-armv7/libssl.so }
But it looks like Android is trying to load a different implementation from
/system
. Perhaps Google changed something again in Android 10 :( Or the paths are wrong and APK does not really contain these .so files. -
when I tried to check suport for openssl QT android
using
qDebug() << "sslsslssl==="<<QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString();It gives me
sslsslssl=== false "OpenSSL 1.1.1b 26 Feb 2019" -
Huh, that's bizarre. Looks like it does see the SSL libs but cannot use them? Weird. Sorry, I don't think I know how to solve it. The only thing that comes to my mind is that perhaps you are using old Qt which expects OpenSSL 1.0 instead of 1.1.
-
@sierdzio Ohhh
I am using
QT creator 4.9.1
Qt based on QT 5.13.0android NDK version 20.0.5594570
android sdk version 26.1.1 -
Qt 5.13 is recent enough, I think, but you can check with 5.14.1 just to be sure.
-
@sierdzio I cheked that too but same issue
-
@AMOL have you tried libs from https://github.com/KDAB/android_openssl
-
@ekkescorner yes I have tried this also
-
Good news!!! I am able to resolve issue, Reason is I have to use QT 5.13.1 instead of 5.13.0.
Thank you all for helping me out and suggesting different solution.
Good day and Happy coding!!! :) :) :)