2022-06-03 11:26:02 +00:00
|
|
|
// Copyright (C) 2021 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
2020-04-03 14:33:15 +00:00
|
|
|
|
|
|
|
/*!
|
2022-05-05 11:15:10 +00:00
|
|
|
\page android.html
|
|
|
|
\title Qt for Android
|
|
|
|
\brief Provides information about Android support in Qt.
|
|
|
|
\ingroup supportedplatform
|
2023-02-22 12:08:24 +00:00
|
|
|
\previouspage Android GNU C++ Run-time Licensing
|
2022-05-05 11:15:10 +00:00
|
|
|
\nextpage android-getting-started.html
|
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
Qt for Android enables you to develop Qt applications for Android devices,
|
|
|
|
and supports a wide range of features and use-cases.
|
2022-05-05 11:15:10 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
To download and install Qt for Android, follow the instructions on the
|
|
|
|
\l{Getting Started with Qt for Android} page. To build Qt from source,
|
|
|
|
see \l{Qt for Android - Building from Source}{Building from Source}.
|
2022-05-05 11:15:10 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\target android-supported-configurations
|
|
|
|
\section1 Supported Configurations
|
|
|
|
|
2022-06-22 13:47:00 +00:00
|
|
|
The following development environments and target system configurations are
|
|
|
|
supported in Qt \QtVer:
|
2022-05-05 11:15:10 +00:00
|
|
|
|
|
|
|
\include supported-platforms.qdocinc android
|
|
|
|
|
2022-06-22 13:47:00 +00:00
|
|
|
\table 50%
|
|
|
|
\header \li {4,1} Target Devices used in Automated Testing
|
|
|
|
\header \li Device \li OS Version \li Architecture \li Form Factor
|
|
|
|
\row \li \l{Pixel 3A}
|
|
|
|
\li Android 10 (API 29)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\row \li \l{Pixel 4A}
|
|
|
|
\li Android 12 (API 31)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\row \li \l{Samsung Galaxy Tab S4}
|
|
|
|
\li Android 10 (API 29)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Tablet
|
|
|
|
\row \li \l{Google Pixel 6 Pro}
|
|
|
|
\li Android 13 Beta 4.1
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\row \li \l{Samsung Galaxy S21}
|
|
|
|
\li Android 12 (API 31)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\row \li \l{Motorola MotoG 3rd}
|
|
|
|
\li Android 6.0.1 (API 23)
|
|
|
|
\li armv7
|
|
|
|
\li Mobile
|
|
|
|
\row \li Huawei Honor
|
|
|
|
\li Android 6.0.1 (API 23)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\row \li \l{Samsung Galaxy S10}
|
|
|
|
\li Android 9 (API 28)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\row \li \l{Pixel 4}
|
|
|
|
\li Android 11 (API 30)
|
|
|
|
\li armv7, arm64_v8a
|
|
|
|
\li Mobile
|
|
|
|
\endtable
|
|
|
|
|
|
|
|
\note Qt for Android support is inclusive of \b{but not limited to} these devices.
|
|
|
|
|
|
|
|
\note The above table is accurate at the time of this Qt patch release only.
|
|
|
|
It may change during the patch release cycle and should only be used as a
|
|
|
|
reference for what the Qt Company can rapidly reproduce bugs on.
|
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section1 Where to Go from Here
|
|
|
|
|
|
|
|
We invite you to explore the rest of Qt. We prepared overviews which help
|
|
|
|
you decide which APIs to use and our examples demonstrate how to use our
|
|
|
|
APIs.
|
2022-05-05 11:15:10 +00:00
|
|
|
|
|
|
|
\list
|
2022-05-05 14:08:37 +00:00
|
|
|
\li \l{Qt Overviews} - list of topics about application development
|
|
|
|
\li \l{Qt Examples and Tutorials}{Examples and Tutorials} - code samples and tutorials
|
|
|
|
\li \l{Qt Reference Pages} - a listing of C++ and QML APIs
|
2022-08-22 10:16:13 +00:00
|
|
|
\li \l{Qt Creator: Creating a Mobile Application}
|
2022-10-04 07:46:39 +00:00
|
|
|
\li \l{Qt Creator: Specifying Android Device Settings}
|
2022-05-05 11:15:10 +00:00
|
|
|
\endlist
|
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
The following topics also provide more details about Qt for Android:
|
2022-05-05 11:15:10 +00:00
|
|
|
|
|
|
|
\annotatedlist androidplatform
|
2022-05-05 14:08:37 +00:00
|
|
|
|
|
|
|
Qt's vibrant and active \l{https://www.qt.io/developers}{community site}
|
|
|
|
houses a wiki, a forum, and additional learning guides and presentations.
|
2020-04-03 14:33:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2022-05-05 11:15:10 +00:00
|
|
|
\page android-getting-started.html
|
|
|
|
\title Getting Started with Qt for Android
|
|
|
|
\brief Provides instructions to install and configure your development environment.
|
|
|
|
\ingroup androidplatform
|
|
|
|
\previouspage android.html
|
|
|
|
\nextpage android-building.html
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-10-03 12:29:38 +00:00
|
|
|
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.
|
|
|
|
|
2022-10-05 08:14:11 +00:00
|
|
|
\youtube 5OiIqFTjUZI
|
2022-10-03 12:29:38 +00:00
|
|
|
|
|
|
|
The rest of this page has more detailed getting started information.
|
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
To download and install Qt for Android, follow the instructions on the
|
|
|
|
\l{Getting Started with Qt} page.
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section1 Android Development Prerequisites
|
2021-11-17 13:26:10 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
In order to develop with \l{Qt for Android}, you will also need the following
|
|
|
|
prerequisites:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\list
|
2022-05-05 14:08:37 +00:00
|
|
|
\li Java Development Kit (JDK) for Java development
|
|
|
|
\li \l{Android: Android command line tools}{Android SDK Command Line Tools}
|
|
|
|
for managing dependencies required for developing with Qt for Android,
|
|
|
|
including:
|
|
|
|
\list
|
|
|
|
\li \l{Android: Android SDK Platforms}{Android SDK Platform}
|
|
|
|
\li \l{Android: Android SDK Platform Tools}{Android SDK Platform Tools}
|
|
|
|
\li \l{Android: Android SDK Build Tools}{Android SDK Build Tools}
|
|
|
|
\li \l{Android: The Android NDK}{Android NDK}
|
|
|
|
\endlist
|
|
|
|
\endlist
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
The easiest way to manage these dependencies is by using Qt Creator's built in
|
|
|
|
Android development setup. For more information, see
|
|
|
|
\l{Qt Creator: Specifying Android Device Settings}.
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section2 Manually Installing the Prerequisites
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
If you prefer to manually install the prerequisites please follow
|
|
|
|
these next steps.
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section3 Java Development Kit (JDK)
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-06-22 13:47:00 +00:00
|
|
|
Qt for Android development requires JDK 11 or above, provided by any of the
|
|
|
|
following supported distributions:
|
2020-08-10 11:58:35 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\list
|
|
|
|
\li \l{AdoptOpenJDK}
|
|
|
|
\li \l{OpenJDK}
|
|
|
|
\li \l{Java SE Development Kit}
|
2022-05-05 11:15:10 +00:00
|
|
|
\endlist
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
Please install your preferred JDK, and then make sure the \c JAVA_HOME
|
|
|
|
environment variable is pointing to the location of the installed JDK.
|
|
|
|
|
|
|
|
For example for Linux:
|
|
|
|
|
|
|
|
\badcode
|
|
|
|
sudo apt-get install openjdk-11-jdk
|
|
|
|
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
Or for \macOS:
|
|
|
|
|
|
|
|
\badcode
|
|
|
|
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)"
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
\section3 Android SDK Command Line Tools
|
|
|
|
|
|
|
|
Install the latest version of the
|
|
|
|
\l{Android: Android command line tools}{Android SDK Command Line Tools}
|
|
|
|
for your operating system, and verify that the installation succeeded by running
|
|
|
|
the \l{Android: sdkmanager}{sdkmanager} binary:
|
|
|
|
|
|
|
|
\badcode
|
|
|
|
sdkmanager --version
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
Then make sure the \c ANDROID_SDK_ROOT environment variable is pointing to the
|
|
|
|
location of the installed command line tools.
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
For example for \macOS:
|
|
|
|
|
|
|
|
\badcode
|
|
|
|
brew install android-commandlinetool
|
|
|
|
export ANDROID_SDK_ROOT="$(brew --prefix)/share/android-commandlinetools"
|
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section3 Android SDK
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2023-04-06 09:18:27 +00:00
|
|
|
The required version of the Platform, Platform Tools, and Build Tools for \QtVer is 33.
|
2022-05-05 14:08:37 +00:00
|
|
|
|
|
|
|
To install all of these run the following command:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
2023-08-03 09:42:33 +00:00
|
|
|
sdkmanager "platforms;android-33" "platform-tools" "build-tools;33.0.0"
|
2022-05-05 11:15:10 +00:00
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section3 Android NDK
|
|
|
|
|
2022-11-07 12:41:01 +00:00
|
|
|
The required version of the Android NDK for \QtVer is 25.1.8937393.
|
2020-10-19 16:45:23 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
To install the NDK run the following command:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
2022-11-07 12:41:01 +00:00
|
|
|
sdkmanager "ndk;25.1.8937393"
|
2022-05-05 11:15:10 +00:00
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
Then make sure the \c ANDROID_NDK_ROOT environment variable is pointing to the
|
|
|
|
location of the installed NDK.
|
|
|
|
|
|
|
|
For example for \macOS:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\badcode
|
2023-06-14 15:26:49 +00:00
|
|
|
export ANDROID_NDK_ROOT="$(brew --prefix)/share/android-commandlinetools/ndk/25.1.8937393/"
|
2022-05-05 14:08:37 +00:00
|
|
|
\endcode
|
|
|
|
|
|
|
|
\section3 Emulator
|
|
|
|
|
|
|
|
If you wish to use the \l{Android: Android Emulator}{Android Emulator},
|
|
|
|
you can install it by running:
|
|
|
|
|
|
|
|
\badcode
|
|
|
|
sdkmanager "emulator" "patcher;v4"
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
\section3 Platform Specific Configurations
|
|
|
|
|
|
|
|
\section4 Windows
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
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 \e extras Android SDK package. To install it, run the following:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
2022-05-05 14:08:37 +00:00
|
|
|
sdkmanager.bat "extras;google;usb_driver"
|
2022-05-05 11:15:10 +00:00
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
After the package installation is complete, install the driver from
|
|
|
|
\c{<ANDROID_SDK_ROOT>/extras/google/usb_driver}. Try running a few basic
|
|
|
|
\l{Android: adb}{adb} commands now and check whether your Android device
|
|
|
|
responds to them.
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section4 Linux
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
The following dependencies are needed for using tools such as \c adb or \c gdb which
|
|
|
|
can be used by Qt Creator:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
2022-05-05 14:08:37 +00:00
|
|
|
sudo apt-get install libstdc++6 libncurses5
|
2022-05-05 11:15:10 +00:00
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\target emulator dependencies
|
|
|
|
To run the Android emulator, the following dependencies are also necessary:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
2022-05-05 14:08:37 +00:00
|
|
|
sudo apt-get install libsdl1.2debian
|
2022-05-05 11:15:10 +00:00
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 14:08:37 +00:00
|
|
|
\section3 Testing Your Setup
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
Now you can test your development setup by running the examples shipped with the
|
|
|
|
Qt installation. For more information, see \l {Qt for Android Examples}.
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
To develop a simple application from scratch, see
|
|
|
|
\l {Qt Creator: Creating a Mobile Application}.
|
2020-04-03 14:33:15 +00:00
|
|
|
*/
|