Important: Please read the Qt Code of Conduct -

Android: Downloading from HTTPS does not work

  • Qt 5.12 LTS
    Android NDK r14
    Android SDK r25.2.5 for 28.0.2

    Qt Creator 4.8.0
    Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit)
    Built on Dec 3 2018 13:07:25
    From revision d51ddbb8f0

    HTTPS support for Android does not work. It should also be noted that HTTPS works fine on iOS devices.

    On Android 6-8 devices, it causes an app attempting to download a file from an HTTPS url to signal “done” and download nothing.

    Error: QSslSocket::connectToHostEncrypted: TLS initialization failed

    D appname: FileDownLoader::RequestFileFromServer..from:  ""
    E linker  : library "/system/lib/" ("/system/lib/") needed or dlopened by "/data/app/com.companyname.appname-nV0MXGxGe9soTVz8ADNyYw==/lib/arm/" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/com.companyname.appname-nV0MXGxGe9soTVz8ADNyYw==/lib/arm:/data/app/com.companyname.appname-nV0MXGxGe9soTVz8ADNyYw==/base.apk!/lib/armeabi-v7a", permitted_paths="/data:/mnt/expand:/data/data/com.companyname.appname"]
    W appname: QSslSocket::connectToHostEncrypted: TLS initialization failed

    HTTP support for Android 6,7,8 works fine. (I have only tested on a device with 8) That is to say..the same exact code accessing a HTTP VS HTTPS url downloads as expected when tested on Android 8.

    In searching for a solution on-line, it appears to be that Android OSes pre-6 all shipped or included SSL support. While that is no longer the case with 6 and up.

    Where do I find pre-compiled libraries that support SSL and HTTPS or whatever else is required to make Qt work on Android 6,7,&8 ?

    Apparently this has already been “bugged” but after 3 months still unresolved:

    Other than NOT using HTTPS for Android and using HTTP there a solution?

  • Lifetime Qt Champion


    The procedure is explained in the Android dedicated page in Qt's documentation.

  • @SGaist

    Thanks. Yes I saw that page.


    I get that I could do that, but what am I paying my monthly $99 license fee for???

    Shouldn't Qt include basic HTTPS functionality and support in their products if they market them as Cross Platform?

    Why would Qt make this the responsibility of each and every Android developer using their product..when they could do it once and make sure it was done correctly????

    Rant finished.

  • Lifetime Qt Champion

    @PSI_lbc You should read the link posted by @SGaist
    "The Qt installation package comes with OpenSSL support but the OpenSSL libraries are not part of the package due to legal restrictions in some countries."
    Also, if you have a commercial license and want to talk to Qt Company you should contact them directly instead of doing it here. This is a forum where volunteers are helping.

  • This is clearly about the worst possible way to do this.

    Most (for all practical purposes - all) applications that use any kind of external WEB/REST/Websockets API's will use https .

    In stead of forcing each and every developer to manually add openssl to the build, creating friction with and frustration about Qt in the process, - why don't you just provide a button in the build or project settings where we can enable openssl for that build / project?

    That will solve the legal problem, and save quite a few wasted hours for developers.

    I was planning to showcase a Qt/QML application for Linux Desktop and Android tomorrow - but I'm not wasting a Sunday on this BS. Now I will go for a walk with my dogs, and just forget about the Android demo. Linux Desktop will do. If someone in the audience asks why I don't have an Android build, I'll just admit it was too much work.

  • Lifetime Qt Champion

    @jgaa You're welcome to submit improvement ideas on the Qt developers mailing list or Qt bug tracker.

Log in to reply