Adding openssl library to apk

  • Hello. I'm trying to build an application for android that uses https urls in QNetworkRequest. I have built openssl library but how do add it to apk using qt-creator? It seems to only add Qt libraries there.

  • I dont know, but maybe it works like I did it with sI added them manually to the pro file. You can rightclick in the pro file and click "Add library", then external library. There you can add the lib and include files, in case they exist. Platform should be none I guess

  • No, that didn't work. It only added external link dependency. The problem is application doesn't need openssl at build-time, it loads it dynamically at run-time. Perhaps I'll have to create separate apk for openssl

  • A was able to add libs to apk by copying library files into projects folder and adding the following to the .pro file:

    android: {
    ssl.files +=


    set ARCH variable in qmake command line.

    However https still doesn't work. The error text is 'Unknown protocol "https"'. Is there any support for SSL in android version of Qt?

  • Moderators

    are you sure your Qt android version is built with OpenSSL support.
    I think it is disabled by default! So you'll have to build it yourself.
    You may also find "this": and "this": bugreport interesting.

  • To clarify this situation, I have few questions:

    1/ Precompiled version of Qt 5.1 SDK for Android (those downloaded from doesn't include OpenSSL supports?

    2/ If not, shall we built Qt 5.1 SDK for Android ourself, following instructions and simply add flag "-openssl" on configure command line?

    3/ Is resulting Qt 5.1 SDK for Android will contain an Android version of OpenSsl that will be "automatically" embedded in any Application .apk package that need it ?

    1. It is compiled without ssl support because of law issues in some countries

    2. -openssl flag for configure will enable dynamic openssl support (i.e. you don't need openssl headers/libs to build qt, but you will need to carry with your application inside the package), you can also set -openssl-linked flag to link qt with libssl (in that case you'll need to install openssl in a separate package to system lib directory). However both methods will probably require qt source from git (last time I checked it was version 5.1.2) due to bug in 5.1.0 (not sure if 5.1.1 still has it) preventing ssl support to compile successfully. Also note that some modules, though included to build by configure script (like serialport), will not compile, you'll need to disable them manually. If you need to build qt for mips you'll have to disable even more modules.

    3. No it won't. You'll have to build openssl for android yourself from source:
      It's also a bit tricky, if you're building for x86 or mips, you'll have to add -lz linker flag manually. After that you'll have to manually add and to your application package (it must be in libs directory).

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.