Qt 5.11 | Getting Started with Qt for Android

Qt 5.11.3 Reference Documentation

# Getting Started with Qt for Android

## Installing the Prerequisites

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

- The Android SDK Tools

  Note: If your Qt version is earlier than v5.9, use the SDK tools package v25.2.5 or earlier.

- The Android NDK (recommended version 10e)
- Java SE Development Kit (JDK) v6 or later. You can also use OpenJDK on Linux.

After installing these tools, update the Android SDK by installing the API and build tools packages required for development. You can install these packages either through Android Studio or using the command line tools package you installed earlier. For more details, refer to the Android Studio documentation.

### Updating the Android SDK

The command line tools provided by the Android SDK Tools package also enables updating the SDK, but without a GUI. For example, the following command on Ubuntu updates the SDK by installing the latest `build-tools`, `platform-tools`, `emulator`, and `patcher` packages:

      ./android update sdk

To install a specific package, use `sdkmanager` from `<ANDROID_SDK_ROOT>/tools/bin`. For example, the following command installs the `android-10` platforms package on Ubuntu:

      ./sdkmanager "platforms;android-10"

For more details, refer to the sdkmanager documentation.

## Configuring Your Development Host

### 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. Use the following command from the Windows command prompt to install the extras package:

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

### 64-bit Linux

If you're developing on a 64-bit Linux machine, you must install the following dependencies in order to run 32-bit executables like `adb`, which allows Qt Creator to find devices to deploy to:

      sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386

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

      sudo apt-get install libsdl1.2debian:i386

### Qt Creator IDE

The Qt Creator IDE that came with the Qt 5 installation on your development host, must be configured to enable developing applications for Android. Launch Qt Creator and select Tools > Options > Devices > Android to add the Android NDK and SDK paths. For more details, refer to Qt Creator Manual.

## Testing Your Setup

Now you can test your development setup by running the examples that came with the Qt 5 installation. You can browse these examples in Qt Creator Welcome mode. Use the `android` filter in the search field to list all the examples tested on Android.

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