Getting Started with Qt for Android

Installing Qt for Android with Qt Installer

See Get and Install Qt and select Qt for Android in the installer.

Manually Installing the Prerequisites

In order to use Qt for Android, you need the following:

  • Java Development Kit (JDK) provided by AdoptOpenJDK for all platforms, is required to build Android apps. Other alternatives such as OpenJDK for Linux or Java SE Development Kit for Windows are also supported.

    Note: JDK 11 or earlier must be used when using Qt for Android.

  • Gradle for building application packages (APK) and app bundles (AAB) for Android devices. Gradle is delivered with Qt.

    Note: Using Ant to build APKs is no longer supported.

  • The Android Command-line SDK Tools to install the following packages that are required to compile Qt applications for Android:
    • Platform tools
    • Build tools
    • At least one SDK platform
    • The Android NDK, which contains toolchains and debuggers for Android.

    Note: Qt Creator 4.12 or later can set up the SDK Tools, NDK, and essential packages automatically. For more information, see Qt Creator: Specifying Android Device Settings.

    Note: If you are using the SDK Tools 26.x or below, the JDK 8 is required. Versions higher than 8 might cause issues for the Android SDK tools.

  • The Android NDK can be installed using the sdkmanager tool. Alternatively, you can download it and extract it manually to a path of your choosing.
DistributionArchitectureCompilerNotes
Android 6.0 or later (API level 23 or higher)armv7a, x86, arm64-v8, and x86_64Clang 11.0.5 (NDK r22b) as provided by Google, MinGW 11.2

Note: Make sure to unpack the Android SDK and NDK to a writable location that Qt Creator can access later. Otherwise, Qt Creator won't be able to use sdkmanager or find all components even if they were installed manually.

Installing the Android SDK Essentials

After downloading and unpacking the Commandline SDK Tools, use the sdkmanager command line tool to install the essential packages:

cd <ANDROID_SDK_ROOT>/tools/bin/
./sdkmanager --sdk_root=<ANDROID_SDK_ROOT> --install "cmdline-tools;latest" "platform-tools" "platforms;android-31" "build-tools;31.0.0" "ndk;22.1.7171670"

Android Studio or the Qt Creator's SDK Manager UI can also be used to install the essential SDK packages.

To use the Android Emulator, install it by entering:

./sdkmanager --sdk_root=<ANDROID_SDK_ROOT> --install "emulator" "patcher;v4"

Host Specific Configuration

Windows

The default USB driver on Windows does not allow debugging using Android Debug Bridge (ADB) tool. You must install the additional USB driver provided by the extras Android SDK package. To install it, run the following:

sdkmanager.bat --sdk_root=<ANDROID_SDK_ROOT> --install "extras;google;usb_driver"

After the package installation is complete, install the driver from <ANDROID_SDK_ROOT>/extras/google/usb_driver. Try running a few basic adb commands now and check whether your Android device responds to them.

Note: These are automatically handled by Qt Creator on first time setup.

Linux

The following dependencies are needed for using tools such as adb or gdb which can be used by Qt Creator:

sudo apt-get install libstdc++6 libncurses5

To run the Android emulator, the following dependencies are also necessary:

sudo apt-get install libsdl1.2debian

Qt Creator IDE

The Qt Creator IDE can be used to develop Qt applications for Android. For more information, see Qt Creator: Connecting Android Devices.

Testing Your Setup

Now you can test your development setup by running the examples shipped with the Qt installation. For more information, see Qt for Android Examples.

To develop a simple application from scratch, see Qt Creator: Creating a Mobile Application.

© 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.