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. If your application depends on OpenSSL, consider packaging the SSL libraries with your Application Package (APK) as the target device may or may not have them. You can use the QSslSocket::supportsSsl() static function to check for SSL support on the target.
The following instructions guide you to build and add the OpenSSL libraries to the APK:
Note: Ensure that you save the script with Unix line-endings if your build host is Unix or Linux.
_ANDROID_EABI
and _ANDROID_ARCH
variables. For example, to build for 64-bit ARM architecture using toolchain version v4.9, set
aarch64-linux-android-4.9
and arch-arm64
values to _ANDROID_EABI
and _ANDROID_ARCH
respectively.windows-x86
or windows-x86_64
to the hosts
list on line 107
, if your build host is Windows.128
to build for 64-bit ARM architecture:
arch-arm64) ANDROID_TOOLS="aarch64-linux-android-gcc aarch64-linux-android-ranlib aarch64-linux-android-ld" ;;
213
if _ANDROID_ARCH
is set to arch-arm64
:
if [ "$_ANDROID_ARCH" == "arch-arm64" ]; then export MACHINE=armv8 export RELEASE=2.6.37 export SYSTEM=android64 export ARCH=arm export CROSS_COMPILE="aarch64-linux-android-" fi
FIPS
section if it is not used or define the FIPS_SIG
environment variable with the FIPS signature location.ANDROID_NDK_ROOT
environment variable with the NDK location.chmod a+x Setenv-android.sh . ./Setenv-android.sh
The script prints the following configuration details to the prompt when it completes:
ANDROID_NDK_ROOT: /home/user1/android-ndk-r10d ANDROID_ARCH: arch-arm64 ANDROID_EABI: aarch64-linux-android-4.9 ANDROID_API: android-21 ANDROID_SYSROOT: /home/user1/android-ndk-r10d/platforms/android-21/arch-arm64 ANDROID_TOOLCHAIN: /home/user1/android-ndk-r10d/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin FIPS_SIG: CROSS_COMPILE: aarch64-linux-androideabi- ANDROID_DEV: /home/user1/android-ndk-r10d/platforms/android-21/arch-arm64/usr
Note: If your development platform is Windows, you need msys
with perl
v5.14 or later to build OpenSSL.
./Configure shared android
Note: You must consider enabling/disabling the SSL features based on the legal restrictions in the region where your application is available. See the SSL configure options for details about the configurable features.
make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" build_libs
to build the libcrypto
and libssl
shared libraries that are not versioned.
Note: Android does not load versioned libraries.
Qt Creator builds your application and creates an application package (APK) with the OpenSSL libraries bundled in it. Once the APK is ready, it uses adb
to deploy the APK on the target you chose and launch the
application.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: