Qt for Android - Building from Source
To build Qt for Android from source please ensure all requirements from Getting Started with Qt for Android are met before continuing.
Building Qt for Android on Windows also requires the following software:
- MinGW 11.2 toolchain
Note: Qt for Android does not support building from source with Microsoft Visual C++ (MSVC).
Install the requirements, and set the
PATH to include the newly installed binaries:
set MINGW_ROOT=<MINGW_ROOT_PATH>\bin set PERL_ROOT=<PERL_ROOT_PATH>\bin set PATH=%MINGW_ROOT%;%PERL_ROOT%;%PATH%
To verify the installation, run:
The command should list mingw32-make.exe under the path <MINGW_ROOT> first.
Qt 6 allows building Qt for Android from source code using
CMake. Qt 6 keeps the same configure script from Qt 5. The main difference is that Qt for Android is dependent on a host Qt build, which means to build Qt for Android, you need to build Qt for the desktop platform used as a host (for example Linux, macOS, or Windows).
To configure Qt for Android, create a shadow build directory to keep the source directory clean:
mkdir <path_to_build_dir>/build-qt cd <path_to_build_dir>/build-qt <path_to_qt_source>/configure -platform android-clang -prefix </path/to/install> -android-ndk <path/to/sdk>/ndk/<ndk_version> -android-sdk <path/to/sdk> -qt-host-path <path_to_host_qt_installation> -android-abis arm64-v8a
And then run the configure script:
<path_to_qt_source>/configure -platform android-clang -prefix </path/to/install> -android-ndk $ANDROID_NDK_ROOT -android-sdk $ANDROID_SDK_ROOT -qt-host-path <path_to_host_qt_installation>
Qt for Android supports the following ABIs:
The following configurations are supported in this Qt release:
|Android 6.0 or later (API level 23 or higher)||Clang 11.0.5 (NDK r22b) as provided by Google, MinGW 11.2||For JDK versions see Java Development Kit (JDK)|
To choose the ABI to build for, use the -android-abis feature of the configure script.
Note: 6.2 does not yet support being built for multiple ABIs at the same time.
Qt for Android contains Java code which is compiled into *.jar files with javac. To set the javac version for source and target, use -android-javac-source and -android-javac-target respectively:
-android-javac-source 8 -android-javac-target 8
To build Qt as a developer build instead of a prefix build, use the following instead of
Qt Configure Options contains more information about the configure options.
To build the configured Qt code, run the following command:
cmake --build . --parallel
Now, to install Qt, run the following command:
cmake --install .
On Unix based OSes you should prefix the install command with the
If you haven't provided the
--prefix <install-dir> configure option, the installation is placed under
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.