- Qt 6.11
- Supported Platforms
- Qt for Android
- Qt for Android Prerequisites
- Qt 6.11.2 Reference Documentation

Getting started ◦ How Qt for Android Works

# Qt for Android Prerequisites

To develop applications for Android using Qt, you need to set up your development environment with the necessary tools and dependencies. This page provides step-by-step instructions to help you get started.

## Android development prerequisites

To develop with Qt for Android, you will need the following prerequisites:

- Java Development Kit (JDK)
- Android Command Line Tools which includes:
  - Android NDK: for building C++ code.
  - Android SDK Platform and Android SDK Build Tools: for building Android apps.
  - Android SDK Platform Tools: for deploying and managing Android dependencies.

## Installing the prerequisites

### Using Qt Creator's Android development setup

The easiest way to manage the dependencies is by using Qt Creator's built-in Android development setup. When you first open Qt Creator after installing Qt for Android, you are asked if you want to run the Android setup wizard. This also sets up OpenSSL for Android.

### Using an existing SDK location

If you already have an Android SDK setup, you don't need to run this wizard. Instead, in Qt Creator go to Preferences > Devices > Android and browse to your existing JDK and SDK paths. See common Android SDK paths. For more information, see Qt Creator: Set up Android development environment.

### Manually Installing the Prerequisites

If you prefer to manually install the prerequisites, follow these next steps.

1. Install the Java Development Kit (JDK).

   Qt for Android development requires JDK 21 or above, provided by any of the following supported distributions:

   - Adoptium
   - OpenJDK
   - Java SE Development Kit

   Install your preferred JDK. If your installer doesn't set the `JAVA_HOME` environment variable that points to the location of the installed JDK, you can set it manually. For example on Linux:

        sudo apt-get install openjdk-21-jdk
        export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64

   Or on macOS:

        brew install openjdk@21
        sudo ln -sfn "$(brew --prefix openjdk@21)/libexec/openjdk.jdk" \
            "/Library/Java/JavaVirtualMachines/openjdk-21.jdk"
        export JAVA_HOME="$(/usr/libexec/java_home -v 21)"

2. Install the Android SDK Command Line Tools. Download the latest version of the Android SDK Command Line Tools for your operating system and extract it to the appropriate path as stated below.

   The Android SDK is commonly installed by Qt Creator or Android Studio in the following locations:

   - Linux: ~/Android/Sdk/
   - macOS: ~/Library/Android/sdk/
   - Windows: C:\Users\<USER>\AppData\Local\Android\Sdk\

   Or use your OS's package manager, for example for macOS:

        brew install android-commandlinetools

3. Install the Android SDK Platform, Build Tools, and Platform Tools.

   Make sure to install the SDK Platform, Platform Tools, and Build Tools. For Qt 6.11, use:

        sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"

4. Install the Android NDK.

   Qt 6.11 uses NDK 27.2.12479018, you can install it by running:

        sdkmanager "ndk;27.2.12479018"

5. (Optional) Install the Android Emulator.

   If you wish to use the Android Emulator, you can install it by running:

        sdkmanager "emulator"

6. Platform Specific Configurations
   - For Windows, you need to install the additional USB driver provided by the extras Android SDK package. Install it by running the following:

          sdkmanager.bat "extras;google;usb_driver"

   - For 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

     Note: Hardware acceleration is required for acceptable Android emulator performance. Without it, the emulator uses software CPU emulation, which runs extremely slowly. See Android: Emulator Acceleration for more information.

### Testing the Setup

After you have installed and configured the prerequisites, you can test your development setup by running the examples shipped with the Qt installation. For more information, see Mobile Examples.

Getting started ◦ How Qt for Android Works