2020-04-03 14:33:15 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2021-11-17 13:26:10 +00:00
|
|
|
** Copyright (C) 2021 The Qt Company Ltd.
|
2020-04-03 14:33:15 +00:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
**
|
|
|
|
** This file is part of the documentation of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:FDL$
|
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
**
|
|
|
|
** GNU Free Documentation License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
|
|
** Documentation License version 1.3 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file included in the packaging of
|
|
|
|
** this file. Please review the following information to ensure
|
|
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*!
|
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
|
|
|
|
\previouspage android_runtime_licensing_notes.html
|
|
|
|
\nextpage android-getting-started.html
|
|
|
|
|
|
|
|
Qt for Android enables you to run Qt applications on Android devices.
|
|
|
|
|
|
|
|
For Qt modules that support android targets see:
|
|
|
|
\l{All Modules}{All Supported Qt Modules}.
|
|
|
|
|
|
|
|
The following configurations are supported:
|
|
|
|
|
|
|
|
\include supported-platforms.qdocinc android
|
|
|
|
|
|
|
|
Here is what you can do with Qt for Android:
|
|
|
|
|
|
|
|
\list
|
|
|
|
\li Run \l{Qt Widgets}{Widget-based} and \l{QML Applications}{QML}
|
|
|
|
applications on a device or an emulator.
|
|
|
|
\li Support for the \l{Material Style}{Material Style} with
|
|
|
|
Qt Quick Controls.
|
|
|
|
\li Handle \l{Qt Multimedia}{Multimedia} content.
|
|
|
|
\li Get \l{Qt Sensors}{sensor} readings.
|
|
|
|
\li Retrieve positioning data using satellite or network information.
|
|
|
|
\li Connect and exchange data with \l{Qt Bluetooth}{Bluetooth}
|
|
|
|
and \l{Qt NFC}{NFC}-enabled devices.
|
|
|
|
\li Develop secure applications using OpenSSL library.
|
|
|
|
\li Create \l{Android Services}.
|
|
|
|
\li Create and deploy Application Package (APK) and Android App Bundle (AAB)
|
|
|
|
packages using Qt Creator.
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
See \l{Getting Started with Qt for Android}.
|
|
|
|
|
|
|
|
The following topics provide more details about Qt for Android:
|
|
|
|
\annotatedlist androidplatform
|
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-05-05 11:15:10 +00:00
|
|
|
\section1 Installing Qt for Android with Qt Installer
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
See \l{Get and Install Qt} and select Qt for Android in the installer.
|
2021-11-17 13:26:10 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section1 Manually Installing the Prerequisites
|
|
|
|
In order to use \l{Qt for Android}, you need the following:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\list
|
|
|
|
\li Java Development Kit 11 (JDK) or above provided by \l{AdoptOpenJDK} for all platforms,
|
|
|
|
is required to build Android apps. Other alternatives such as \l{OpenJDK}
|
|
|
|
for Linux and macOS or \l{Java SE Development Kit} for Windows are also supported.
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\li \l{Gradle} 7.2 for building application packages (APK) and app bundles
|
|
|
|
(AAB) for Android devices. Gradle is delivered with Qt.
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\target android-sdk
|
|
|
|
\li \l{Android: The Android SDK Tools}{The Android Command-line SDK Tools}
|
|
|
|
to install the following packages that are required to compile Qt
|
|
|
|
applications for Android:
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\list
|
|
|
|
\li Platform tools
|
|
|
|
\li Build tools
|
|
|
|
\li At least one SDK platform
|
|
|
|
\li \l {android-ndk}{The Android NDK}, which contains toolchains
|
|
|
|
and debuggers for Android.
|
|
|
|
\endlist
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\note Qt Creator 4.12 or later can set up the SDK Tools, NDK, and
|
|
|
|
essential packages automatically. For more information, see
|
|
|
|
\l {Qt Creator: Specifying Android Device Settings}.
|
2020-04-07 14:46:21 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\note If you are using the SDK Tools 26.x or below, the JDK 8 is required.
|
|
|
|
Versions higher than 8 might cause issues for \l {android-sdk}{the Android SDK tools}.
|
2020-08-10 11:58:35 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\target android-ndk
|
|
|
|
\li \l{Android: The Android NDK}{The Android NDK}
|
|
|
|
can be installed using the \c sdkmanager tool. Alternatively, you can
|
|
|
|
download it and extract it manually to a path of your choosing.
|
|
|
|
\endlist
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\include supported-platforms.qdocinc android
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\note Make sure to unpack the Android SDK and NDK to a writable location that Qt Creator
|
|
|
|
can access later. Otherwise, Qt Creator won't be able to use \c sdkmanager or find all
|
|
|
|
components even if they were installed manually.
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section2 Installing the Android SDK Essentials
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
After downloading and unpacking the Commandline SDK Tools, use the \c sdkmanager
|
|
|
|
command line tool to install the essential packages:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
|
|
|
cd <ANDROID_SDK_ROOT>/tools/bin/
|
|
|
|
./sdkmanager --sdk_root=<ANDROID_SDK_ROOT> --install "cmdline-tools;latest" "platform-tools" "platforms;android-31" "build-tools;31.0.0" "ndk;22.1.7171670"
|
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\l {Android: Android Studio}{Android Studio} or the Qt Creator's
|
|
|
|
\l{Qt Creator: Managing Android SDK Packages}{SDK Manager UI} can also be used
|
|
|
|
to install the essential SDK packages.
|
2020-10-19 16:45:23 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
To use the \l {Android: Android Emulator}{Android Emulator}, install it by
|
|
|
|
entering:
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\badcode
|
|
|
|
./sdkmanager --sdk_root=<ANDROID_SDK_ROOT> --install "emulator" "patcher;v4"
|
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section1 Host Specific Configuration
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section2 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
|
|
|
|
sdkmanager.bat --sdk_root=<ANDROID_SDK_ROOT> --install "extras;google;usb_driver"
|
|
|
|
\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 11:15:10 +00:00
|
|
|
\note These are automatically handled by Qt Creator on first time setup.
|
2021-11-17 13:26:10 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section2 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
|
|
|
|
sudo apt-get install libstdc++6 libncurses5
|
|
|
|
\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
|
|
|
|
sudo apt-get install libsdl1.2debian
|
|
|
|
\endcode
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section2 Qt Creator IDE
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
The Qt Creator IDE can be used to develop Qt applications for Android. For more
|
|
|
|
information, see \l{Qt Creator: Connecting Android Devices}.
|
2020-04-03 14:33:15 +00:00
|
|
|
|
2022-05-05 11:15:10 +00:00
|
|
|
\section1 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
|
|
|
*/
|