Qt Android Deployment

Learn how to deploy your Qt Application on Android

Featured image

Qt Android Deployment

This tutorial will be focused on showing the steps to deploy your app on any Android device using Qt. It is not necessary to write the code in QML to do this.

Note: It will help if a layout is provided so that screen dimensions will be automatically taken care.

Video Tutorial

Qt Android Deployment Youtube Video

App Download Link: https://sourceforge.net/p/multicopypaste/wiki/Home/

Github Link: https://github.com/harshmittal2210/multiCopyPaste

Android Installation

For Android installation, you can refer to here: Qt Official Link

The following section has been created using the same tutorial.

Install Android in Qt Maintainer

Qt Android Installation from Qt Maintainer

Installation Progress

Setup Android in Qt

Head to: Qt Creator -> Tools -> Devices -> Android

Android Settings in Qt

As you can see currently all the Android settings are in red, so we will set them up one by one

Setup JDK

Setup JDK

It will take you to the website and help you install jdk

For Windows:

Windows JDK Setup

For Linux:

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

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)"

Once completed you will be able to see green ticks for JDK like this:

JDK Installation Complete

Confirm using the terminal:

sdkmanager --version

Setup Android SDK

Android SDK Installation

This will install Android SDK automatically.

Android SDK Installation Status

Install the missing packages:

Android SDK Missing Package Installation

Android SDK Missing Package Installation Status

Android SDK Missing Package Installation Status

Now you should be able to see all green ticks:

Android Installation Status

Android SDK Manager

Setup Android SDK for different Android versions

Andoid SDK Manager

Andoid SDK Manager Setup

Andoid SDK Manager Setup

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

With this Android is set up in the Qt. Now we will test our application to generate APK and run it on an actual Android device.

MultiCopyPaste Example Android Build

Qt Android Deployment Youtube Video

App Download Link: https://sourceforge.net/p/multicopypaste/wiki/Home/

Github Link: https://github.com/harshmittal2210/multiCopyPaste