- Qt 6.4
- Getting Started with Qt for Android
- Qt 6.4.3 Reference Documentation

Qt for Android ◦ Qt for Android - Building from Source

# Getting Started with Qt for Android

The video below is a beginner's guide to using the Qt for Android toolchain, including the Qt Creator IDE, to get you started developing Android apps.

The rest of this page has more detailed getting started information.

To download and install Qt for Android, follow the instructions on the Getting Started with Qt page.

## Android Development Prerequisites

In order to develop with Qt for Android, you will also need the following prerequisites:

- Java Development Kit (JDK) for Java development
- Android SDK Command Line Tools for managing dependencies required for developing with Qt for Android, including:
  - Android SDK Platform
  - Android SDK Platform Tools
  - Android SDK Build Tools
  - Android NDK

The easiest way to manage these dependencies is by using Qt Creator's built in Android development setup. For more information, see Qt Creator: Specifying Android Device Settings.

### Manually Installing the Prerequisites

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

#### Java Development Kit (JDK)

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

- AdoptOpenJDK
- OpenJDK
- Java SE Development Kit

Please install your preferred JDK, and then make sure the `JAVA_HOME` environment variable is pointing to the location of the installed JDK.

For example for Linux:

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

Or for macOS:

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

#### Android SDK Command Line Tools

Install the latest version of the Android SDK Command Line Tools for your operating system, and verify that the installation succeeded by running the sdkmanager binary:

     sdkmanager --version

Then make sure the `ANDROID_SDK_ROOT` environment variable is pointing to the location of the installed command line tools.

For example for macOS:

     brew install android-commandlinetool
     export ANDROID_SDK_ROOT="$(brew --prefix)/share/android-commandlinetools"

#### Android SDK

The required version of the Platform, Platform Tools, and Build Tools for 6.4 is 31.

To install all of these run the following command:

     sdkmanager "platforms;android-31" "platform-tools" "build-tools;31.0.0"

#### Android NDK

The required version of the Android NDK for 6.4 is 23.1.7779620.

To install the NDK run the following command:

     sdkmanager "ndk;23.1.7779620"

Then make sure the `ANDROID_NDK_ROOT` environment variable is pointing to the location of the installed NDK.

For example for macOS:

     export ANDROID_NDK_ROOT="$(brew --prefix)/share/android-commandlinetools/ndk/23.1.7779620/"

#### Emulator

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

     sdkmanager "emulator" "patcher;v4"

#### Platform Specific Configurations

##### 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 "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.

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

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