In order to use Qt for Android, you need the following:
Note: If your Qt version is earlier than v5.9, use the SDK tools package v25.2.5 or earlier.
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.
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
./android update sdk
To install a specific package, use
<ANDROID_SDK_ROOT>/tools/bin. For example, the following command installs the
android-10 platforms package on Ubuntu:
For more details, refer to the sdkmanager documentation.
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:
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.
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
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.
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.