Doc: Update Android docs
Fixes: QTCREATORBUG-28858 Task-number: QTCREATORBUG-28721 Change-Id: Id18a2ad0f88600362a5d10e36b3e3d95e5d19644 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
BIN
doc/qtcreator/images/extraimages/images/5OiIqFTjUZI.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
@@ -1,2 +1,3 @@
|
|||||||
{HTML.extraimages,qhp.QtCreator.extraFiles} += \
|
{HTML.extraimages,qhp.QtCreator.extraFiles} += \
|
||||||
images/commercial.png
|
images/commercial.png \
|
||||||
|
images/5OiIqFTjUZI.jpg
|
||||||
|
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 10 KiB |
BIN
doc/qtcreator/images/qtcreator-android-sdk-manager.webp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
doc/qtcreator/images/qtcreator-build-settings-android-apk.webp
Normal file
After Width: | Height: | Size: 7.2 KiB |
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2022 The Qt Company Ltd.
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -8,36 +8,37 @@
|
|||||||
|
|
||||||
\title Connecting Android Devices
|
\title Connecting Android Devices
|
||||||
|
|
||||||
You can connect Android devices to the development PC using USB cables
|
You can connect Android devices to the development PC using USB cables to
|
||||||
to build, run, debug, and analyze applications from \QC. Devices with
|
build, run, debug, and analyze applications from \QC.
|
||||||
Android version 4.1 (API level 16) or later are supported when developing
|
|
||||||
with Qt 5 and devices with Android version 6.0 (API level 23) when
|
|
||||||
developing with Qt 6.
|
|
||||||
|
|
||||||
To develop for Android, you must have a tool chain for building applications
|
To develop for Android, you must install a tool chain for building
|
||||||
for Android devices installed on the development PC. \QC can automatically
|
applications for Android devices on the development PC. \QC can automatically
|
||||||
download and install the tool chain and create a suitable build and run
|
download and install the tool chain and create a suitable build and run
|
||||||
\l{glossary-buildandrun-kit}{kit} that has the tool chain and the Qt
|
\l{glossary-buildandrun-kit}{kit} that has the tool chain and the Qt
|
||||||
version for Android for the device's architecture.
|
version for Android for the device's architecture.
|
||||||
|
|
||||||
Starting from Qt 5.14.0, the Qt for Android package has all the
|
|
||||||
architectures (ABIs) installed as one.
|
|
||||||
|
|
||||||
To enable helpful code editing features for Java, such as code completion,
|
To enable helpful code editing features for Java, such as code completion,
|
||||||
highlighting, function tooltips, and navigating in code, add a
|
highlighting, function tooltips, and navigating in code, add a
|
||||||
\l{Java Language Server}{Java language server}.
|
\l{Java Language Server}{Java language server}.
|
||||||
|
|
||||||
The Android Debug Bridge (adb) command line tool is integrated to \QC to
|
\QC integrates the Android Debug Bridge (\c adb) command line tool for
|
||||||
enable you to deploy applications to connected Android devices, to run
|
deploying applications to Android devices, running them, and reading their
|
||||||
them, and to read their logs. It includes a client and server that run on
|
logs. The \c adb tool includes a client and server that run on
|
||||||
the development host and a daemon that runs on the emulator or device.
|
the development host and a daemon that runs on the emulator or device.
|
||||||
|
|
||||||
|
The following video shows the whole process from installing Qt for Android
|
||||||
|
to debugging an application on an Android device:
|
||||||
|
|
||||||
|
\youtube 5OiIqFTjUZI
|
||||||
|
|
||||||
\section1 Requirements
|
\section1 Requirements
|
||||||
|
|
||||||
To use \QC to develop Qt applications for Android, you need
|
To use \QC to develop Qt applications for Android, you need
|
||||||
\l{Qt for Android} 5.2, or later, and the tool chain that \QC
|
\l {Qt for Android} and a tool chain that \QC can automatically
|
||||||
can automatically download, install, and configure for you.
|
download, install, and configure for you. For more information
|
||||||
For more information, see \l{Manually Installing the Prerequisites}.
|
about the requirements for developing with a particular Qt version,
|
||||||
|
see the documentation for that Qt version. The links in this manual
|
||||||
|
lead to the latest released Qt reference documentation.
|
||||||
|
|
||||||
\section1 Specifying Android Device Settings
|
\section1 Specifying Android Device Settings
|
||||||
|
|
||||||
@@ -58,42 +59,39 @@
|
|||||||
\uicontrol Android on Windows and Linux or \uicontrol {\QC} >
|
\uicontrol Android on Windows and Linux or \uicontrol {\QC} >
|
||||||
\uicontrol Preferences > \uicontrol Devices > \uicontrol Android on
|
\uicontrol Preferences > \uicontrol Devices > \uicontrol Android on
|
||||||
\macos.
|
\macos.
|
||||||
\image qtcreator-options-android-main.png "Android preferences"
|
\image qtcreator-options-android-main.png {Android preferences}
|
||||||
\li In the \uicontrol {JDK location} field, set the path to the JDK.
|
\li In the \uicontrol {JDK location} field, set the path to the JDK.
|
||||||
\QC checks the JDK installation and reports errors.
|
\QC checks the JDK installation and reports errors.
|
||||||
|
|
||||||
By default, \QC tries to find a supported \l{AdoptOpenJDK} or
|
By default, \QC tries to find a supported \l{AdoptOpenJDK} or
|
||||||
\l{OpenJDK} installation. If none is found, you must set the path
|
\l{OpenJDK} installation. If it cannot find one, you must set the
|
||||||
manually. If you don't have a supported JDK installed, select
|
path manually. If you have not installed a supported JDK, select
|
||||||
\inlineimage icons/online.png
|
\inlineimage icons/online.png
|
||||||
to open the JDK download web page in the default browser.
|
to open the JDK download web page in the default browser.
|
||||||
|
|
||||||
\note We recommended using a 64-bit JDK because the 32-bit one
|
\note Use a 64-bit JDK because the 32-bit one might cause issues with
|
||||||
might cause issues with \c cmdline-tools, and some packages might
|
\c cmdline-tools, and some packages might not appear in the list.
|
||||||
not be listed.
|
|
||||||
\li In the \uicontrol {Android SDK location} field, set the path to the
|
\li In the \uicontrol {Android SDK location} field, set the path to the
|
||||||
folder where you want the \l{Android SDK Command-line Tools} to be
|
folder to install the \l{Android SDK Command-line Tools}.
|
||||||
installed.
|
|
||||||
\li Select \uicontrol {Set Up SDK} to automatically download and extract
|
\li Select \uicontrol {Set Up SDK} to automatically download and extract
|
||||||
the Android SDK Command-line Tools to the selected path.
|
the Android SDK Command-line Tools to the selected path.
|
||||||
|
|
||||||
The SDK Manager checks whether the tool chain is installed.
|
The SDK Manager checks that you have the necessary tools. If you need
|
||||||
If packages are missing or updates are needed, the SDK Manager
|
more packages or updates, the SDK Manager offers to add or remove
|
||||||
offers to add or remove those packages. Before taking action, it
|
the appropriate packages. Before taking action, it prompts you to
|
||||||
prompts you to accept the changes it is about to make. In addition,
|
accept the changes. In addition, it prompts you to accept Google
|
||||||
it prompts you to accept Google licenses, as necessary.
|
licenses, as necessary.
|
||||||
\li The installed NDK versions are listed in
|
\li The \uicontrol {Android NDK list} lists the installed NDK versions.
|
||||||
\uicontrol {Android NDK list}.
|
The SDK Manager installed the locked items. You can modify them only
|
||||||
The locked items were installed by the SDK Manager,
|
from the \uicontrol {Android SDK Manager} dialog. For more
|
||||||
and can only be modified from the \uicontrol {Android SDK Manager}
|
information, see \l{Managing Android NDK Packages}.
|
||||||
dialog. For more information, see \l{Managing Android NDK Packages}.
|
|
||||||
\li Select the \uicontrol {Automatically create kits for Android tool chains}
|
\li Select the \uicontrol {Automatically create kits for Android tool chains}
|
||||||
check box to allow \QC to create the kits for you. \QC displays a
|
check box to allow \QC to create the kits for you. \QC displays a
|
||||||
warning if it cannot find a suitable Qt version.
|
warning if it cannot find a suitable Qt version.
|
||||||
\li Optionally, in the \uicontrol {Android OpenSSL Settings} group, set
|
\li Optionally, in the \uicontrol {Android OpenSSL Settings} group, set
|
||||||
the path to the prebuilt OpenSSL libraries.
|
the path to the prebuilt OpenSSL libraries.
|
||||||
|
|
||||||
For Qt applications that require OpenSSL support, \QC allows to
|
For Qt applications that require OpenSSL support, you can
|
||||||
quickly add the \l {Android OpenSSL support} to your project.
|
quickly add the \l {Android OpenSSL support} to your project.
|
||||||
For more information, see \l{Adding External Libraries}.
|
For more information, see \l{Adding External Libraries}.
|
||||||
\li Select \uicontrol {Download OpenSSL} to download the OpenSSL
|
\li Select \uicontrol {Download OpenSSL} to download the OpenSSL
|
||||||
@@ -103,21 +101,20 @@
|
|||||||
|
|
||||||
\section2 Manual Setup
|
\section2 Manual Setup
|
||||||
|
|
||||||
\note We recommend that you use the latest Android SDK Command-Line Tools.
|
\note Use the latest Android SDK Command-Line Tools. \QC does not support
|
||||||
Using Android SDK Tools version 25.2.5 or earlier is not supported because
|
Android SDK Tools version 25.2.5 or earlier because it cannot fully
|
||||||
they cannot be fully integrated with \QC.
|
integrate them.
|
||||||
|
|
||||||
However, if the automatic setup does not meet your needs, you can download
|
However, if the automatic setup does not meet your needs, you can download
|
||||||
and install Android SDK Command-line Tools, and then install or update the
|
and install Android SDK Command-line Tools, and then install or update the
|
||||||
NDKs, tools and packages needed for development. For more information, see
|
necessary NDKs, tools, and packages. For more information, see
|
||||||
\l{Getting Started with Qt for Android}.
|
\l{Getting Started with Qt for Android}.
|
||||||
|
|
||||||
\section2 Viewing Android Tool Chain Settings
|
\section2 Viewing Android Tool Chain Settings
|
||||||
|
|
||||||
The Android SDK Command-Line Tools download URL, the essential
|
A JSON configuration file defines the Android SDK Command-Line Tools download
|
||||||
packages list, and the appropriate NDK for each Qt version are defined in a JSON
|
URL, the essential packages list, and the appropriate NDK for each Qt version.
|
||||||
configuration file. The file is located under the user's \QC
|
The file is in the \QC resource folder:
|
||||||
resource folder:
|
|
||||||
|
|
||||||
\badcode
|
\badcode
|
||||||
# Linux and macOS
|
# Linux and macOS
|
||||||
@@ -127,8 +124,8 @@
|
|||||||
C:\Users\Username\AppData\Local\QtProject\qtcreator\android\sdk_definitions.json
|
C:\Users\Username\AppData\Local\QtProject\qtcreator\android\sdk_definitions.json
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
For example, the SDK configuration file defines the NDK version 19.2.5345600
|
For example, the SDK configuration file sets the NDK version 19.2.5345600
|
||||||
to be used for Qt 5.12.0 to 5.12.5 and Qt 5.13.0 to 5.13.1 versions:
|
for use with Qt 5.12.0 to 5.12.5 and Qt 5.13.0 to 5.13.1:
|
||||||
|
|
||||||
\badcode
|
\badcode
|
||||||
"specific_qt_versions": [
|
"specific_qt_versions": [
|
||||||
@@ -150,10 +147,10 @@
|
|||||||
Linux or \uicontrol {\QC} > \uicontrol Preferences > \uicontrol Devices >
|
Linux or \uicontrol {\QC} > \uicontrol Preferences > \uicontrol Devices >
|
||||||
\uicontrol Android on \macos.
|
\uicontrol Android on \macos.
|
||||||
|
|
||||||
\image qtcreator-options-android-sdk-tools.png "Android NDK and SDK checks"
|
\image qtcreator-options-android-sdk-tools.png {Android NDK and SDK checks}
|
||||||
|
|
||||||
The locked versions were installed by the SDK Manager, and can only
|
The SDK Manager installed the locked items. You can modify them only
|
||||||
be modified from the \uicontrol {Android SDK Manager} dialog.
|
in the \uicontrol {Android SDK Manager} dialog.
|
||||||
For more information, see \l{Managing Android SDK Packages}.
|
For more information, see \l{Managing Android SDK Packages}.
|
||||||
|
|
||||||
To manually download NDKs, select \inlineimage icons/online.png
|
To manually download NDKs, select \inlineimage icons/online.png
|
||||||
@@ -173,7 +170,7 @@
|
|||||||
tool, \l {sdkmanager}, for SDK package management. To make SDK management
|
tool, \l {sdkmanager}, for SDK package management. To make SDK management
|
||||||
easier, \QC has an SDK Manager for
|
easier, \QC has an SDK Manager for
|
||||||
installing, updating, and removing SDK packages. You can still use
|
installing, updating, and removing SDK packages. You can still use
|
||||||
sdkmanager for advanced SDK management.
|
\c sdkmanager for advanced SDK management.
|
||||||
|
|
||||||
To view the installed Android SDK packages, select \uicontrol Edit >
|
To view the installed Android SDK packages, select \uicontrol Edit >
|
||||||
\uicontrol Preferences > \uicontrol Devices > \uicontrol Android >
|
\uicontrol Preferences > \uicontrol Devices > \uicontrol Android >
|
||||||
@@ -181,7 +178,7 @@
|
|||||||
\uicontrol Preferences > \uicontrol Devices > \uicontrol Android >
|
\uicontrol Preferences > \uicontrol Devices > \uicontrol Android >
|
||||||
\uicontrol {SDK Manager} on \macos.
|
\uicontrol {SDK Manager} on \macos.
|
||||||
|
|
||||||
\image qtcreator-android-sdk-manager.png "Android SDK Manager"
|
\image qtcreator-android-sdk-manager.webp {Android SDK Manager}
|
||||||
|
|
||||||
You can show packages for the release channel you select in
|
You can show packages for the release channel you select in
|
||||||
\uicontrol {Show Packages} > \uicontrol Channel. Common channel IDs include
|
\uicontrol {Show Packages} > \uicontrol Channel. Common channel IDs include
|
||||||
@@ -194,27 +191,27 @@
|
|||||||
\uicontrol {Update Installed}. Select the packages to update, and then
|
\uicontrol {Update Installed}. Select the packages to update, and then
|
||||||
select \uicontrol Apply.
|
select \uicontrol Apply.
|
||||||
|
|
||||||
To specify advanced sdkmanager settings, select
|
To specify advanced \c sdkmanager settings, select
|
||||||
\uicontrol {Advanced Options} and enter arguments in the
|
\uicontrol {Advanced Options} and enter arguments in the
|
||||||
\uicontrol {SDK Manager arguments} field. The available arguments are listed
|
\uicontrol {SDK Manager arguments} field. \uicontrol {Available arguments}
|
||||||
and described in \uicontrol {Available arguments}.
|
lists the arguments with descriptions.
|
||||||
|
|
||||||
\image qtcreator-android-sdk-manager-arguments.png "Android SDK Manager Arguments dialog"
|
\image qtcreator-android-sdk-manager-arguments.png {Android SDK Manager Arguments dialog}
|
||||||
|
|
||||||
\section1 Managing Android Virtual Devices (AVD)
|
\section1 Managing Android Virtual Devices (AVD)
|
||||||
|
|
||||||
The available AVDs are listed in \uicontrol Edit > \uicontrol Preferences
|
To view the available AVDs, select \uicontrol Edit > \uicontrol Preferences
|
||||||
> \uicontrol Devices on Windows and Linux or \uicontrol {\QC} >
|
> \uicontrol Devices on Windows and Linux or \uicontrol {\QC} >
|
||||||
\uicontrol Preferences > \uicontrol Devices > on \macos. You can add more
|
\uicontrol Preferences > \uicontrol Devices > on \macos. You can add more
|
||||||
AVDs.
|
AVDs.
|
||||||
|
|
||||||
\image qtcreator-android-avd-manager.png "Android device in Devices"
|
\image qtcreator-android-avd-manager.png {Android device in Devices}
|
||||||
|
|
||||||
You can see the status of the selected device in \uicontrol {Current state}.
|
You can see the status of the selected device in \uicontrol {Current state}.
|
||||||
To update the status information, select \uicontrol Refresh.
|
To update the status information, select \uicontrol Refresh.
|
||||||
|
|
||||||
To start an AVD, select \uicontrol {Start AVD}. Usually, you don't need to
|
To start an AVD, select \uicontrol {Start AVD}. Usually, you don't need to
|
||||||
start AVDs separately because they are automatically started when you
|
start AVDs separately because \QC starts them when you
|
||||||
select them in the \l{Building for Multiple Platforms}{kit selector} to
|
select them in the \l{Building for Multiple Platforms}{kit selector} to
|
||||||
\l{Deploying to Android}{deploy applications} to them.
|
\l{Deploying to Android}{deploy applications} to them.
|
||||||
|
|
||||||
@@ -223,7 +220,7 @@
|
|||||||
|
|
||||||
To specify options for starting an AVD, select \uicontrol {AVD Arguments}.
|
To specify options for starting an AVD, select \uicontrol {AVD Arguments}.
|
||||||
|
|
||||||
\image qtcreator-android-avd-arguments.png "Startup options for AVDs"
|
\image qtcreator-android-avd-arguments.png {Startup options for AVDs}
|
||||||
|
|
||||||
Specify the options in \uicontrol {Emulator command-line startup options}.
|
Specify the options in \uicontrol {Emulator command-line startup options}.
|
||||||
For available options, see \l{Start the emulator from the command line}.
|
For available options, see \l{Start the emulator from the command line}.
|
||||||
@@ -247,7 +244,7 @@
|
|||||||
or \uicontrol {\QC} > \uicontrol Preferences > \uicontrol Devices >
|
or \uicontrol {\QC} > \uicontrol Preferences > \uicontrol Devices >
|
||||||
\uicontrol Add > \uicontrol {Android Device} on \macos to open the
|
\uicontrol Add > \uicontrol {Android Device} on \macos to open the
|
||||||
\uicontrol {Create New AVD} dialog.
|
\uicontrol {Create New AVD} dialog.
|
||||||
\image qtcreator-android-create-avd.png "Create New AVD dialog"
|
\image qtcreator-android-create-avd.png {Create New AVD dialog}
|
||||||
\li Set the name, definition, architecture, target API level, and
|
\li Set the name, definition, architecture, target API level, and
|
||||||
SD card size of the device.
|
SD card size of the device.
|
||||||
\li Select \uicontrol OK to create the AVD.
|
\li Select \uicontrol OK to create the AVD.
|
||||||
@@ -258,9 +255,9 @@
|
|||||||
|
|
||||||
\section1 Debugging on Android Devices
|
\section1 Debugging on Android Devices
|
||||||
|
|
||||||
Debugging is enabled in different ways on different Android devices.
|
You enable debugging in different ways on different Android devices.
|
||||||
Look for \uicontrol {USB Debugging} under \uicontrol {Developer Options}. On
|
Look for \uicontrol {USB Debugging} under \uicontrol {Developer Options}. On
|
||||||
some devices \uicontrol {Developer Options} is hidden and becomes visible
|
some devices, \uicontrol {Developer Options} is hidden and becomes visible
|
||||||
only when you tap the \uicontrol {Build number} field in \uicontrol Settings
|
only when you tap the \uicontrol {Build number} field in \uicontrol Settings
|
||||||
> \uicontrol About several times. For more information, see
|
> \uicontrol About several times. For more information, see
|
||||||
\l {Configure on-device developer options}.
|
\l {Configure on-device developer options}.
|
||||||
@@ -269,7 +266,7 @@
|
|||||||
the application for debugging.
|
the application for debugging.
|
||||||
|
|
||||||
\note \QC cannot debug applications on Android devices if Android Studio is
|
\note \QC cannot debug applications on Android devices if Android Studio is
|
||||||
running. If the following message is displayed in \l {Application Output},
|
running. If the following message appears in \l {Application Output},
|
||||||
close Android Studio and try again:
|
close Android Studio and try again:
|
||||||
|
|
||||||
\badcode
|
\badcode
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2022 The Qt Company Ltd.
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -8,24 +8,25 @@
|
|||||||
|
|
||||||
\title Deploying to Android
|
\title Deploying to Android
|
||||||
|
|
||||||
On Android, applications are distributed in specially structured types of
|
Android applications are packaged as ZIP files called Application Packages
|
||||||
ZIP packages called Application Packages (APK) or Android App Bundles (AAB).
|
(APK) or Android App Bundles (AAB). You can install and run APK files on a
|
||||||
APK files can be downloaded to and executed on a device, whereas AAB is
|
device. You can upload AAB files to the Google Play store.
|
||||||
intended to be interpreted by the Google Play store and is used to generate
|
|
||||||
APK files.
|
|
||||||
|
|
||||||
\l{Qt for Android} has binaries for armv7a, arm64-v8a, x86, and x86-64.
|
\l{Qt for Android} has binaries for armv7a, arm64-v8a, x86, and x86-64.
|
||||||
To support several different ABIs in your application, build an AAB that
|
To support several different ABIs in your application, build an AAB that
|
||||||
has binaries for each of the ABIs. The Google Play store uses the
|
has binaries for each of the ABIs. The Google Play store uses the AAB
|
||||||
AAB to generate optimized APK packages for the devices issuing the download
|
to generate optimized APK packages for the devices that request download
|
||||||
request and automatically signs them with your publisher key.
|
and automatically signs them with your publisher key.
|
||||||
|
|
||||||
\QC supports the following methods of deployment for Android applications:
|
\QC supports the following methods of deployment for Android applications:
|
||||||
|
|
||||||
\list
|
\list
|
||||||
\li As a stand-alone, distributable application package (APK).
|
\li As a stand-alone, distributable application package (APK).
|
||||||
\li Since Qt 5.14.0, as an app bundle (AAB), intended for distribution
|
\li As an app bundle (AAB) for distribution in the Google Play store.
|
||||||
in the Google Play store.
|
|
||||||
|
All Qt versions do not support AABs. Qt 6.3.0 and later support
|
||||||
|
multi-abi builds for applications that you build with CMake. For
|
||||||
|
more information, see \l{Qt for Android - Building User Projects}.
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\note Since \QC 4.12, Ministro is not supported.
|
\note Since \QC 4.12, Ministro is not supported.
|
||||||
@@ -39,56 +40,27 @@
|
|||||||
|
|
||||||
\section1 Packaging Applications
|
\section1 Packaging Applications
|
||||||
|
|
||||||
Because bundling applications as APK packages is not
|
Because bundling applications as APK packages is not trivial, Qt has the
|
||||||
trivial, Qt 5 has a deployment tool called \c androiddeployqt.
|
\l {The androiddeployqt Tool}{androiddeployqt} tool. When you deploy an
|
||||||
When you deploy an application using a \e {Qt for Android kit}, \QC uses
|
application using a \e {Qt for Android kit}, \QC runs the tool to
|
||||||
the \c androiddeployqt tool to create the necessary files and to bundle them
|
create the necessary files and to bundle them into an APK. For more
|
||||||
into an APK:
|
information, see \l{Android Package Templates}.
|
||||||
|
|
||||||
\list
|
|
||||||
|
|
||||||
\li Java files, which serve as the entry point into your application and
|
|
||||||
that automatically load Qt and execute the native code in your
|
|
||||||
application.
|
|
||||||
|
|
||||||
\li AndroidManifest.xml, which has meta-information about your
|
|
||||||
application.
|
|
||||||
|
|
||||||
\li Other XML files, which specify the dependencies of your application.
|
|
||||||
|
|
||||||
\li Resource files.
|
|
||||||
|
|
||||||
\li Libraries and QML files, which can be included in the project
|
|
||||||
depending on the deployment method that you select.
|
|
||||||
|
|
||||||
\li Gradle wrappers that are needed to download and use Gradle.
|
|
||||||
|
|
||||||
\li Gradle script that is needed by Java IDEs, such as Android Studio.
|
|
||||||
It allows the user to extend the Java part without copying our Java
|
|
||||||
sources. It also allows the IDEs to offer code completion, syntax
|
|
||||||
highlighting, and so on.
|
|
||||||
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
The Gradle wrappers and scripts are bundled only if you use Gradle to build
|
|
||||||
the application packages. For more information, see
|
|
||||||
\l{Connecting Android Devices}.
|
|
||||||
|
|
||||||
To view the packages that the \c androiddeployqt tool created, select the
|
To view the packages that the \c androiddeployqt tool created, select the
|
||||||
\uicontrol {Open package location after build} check box.
|
\uicontrol {Open package location after build} check box.
|
||||||
|
|
||||||
\section2 Specifying Deployment Settings
|
\section2 Specifying Deployment Settings
|
||||||
|
|
||||||
The available deployment settings are listed in the \uicontrol Method field.
|
The \uicontrol Method field lists deployment settings.
|
||||||
To add deployment methods for a project, select \uicontrol Add.
|
To add deployment methods for a project, select \uicontrol Add.
|
||||||
|
|
||||||
\image qtcreator-android-deployment-settings.png "Deployment settings"
|
\image qtcreator-android-deployment-settings.png {Deployment settings}
|
||||||
|
|
||||||
To rename the current deployment method, select \uicontrol Rename.
|
To rename the current deployment method, select \uicontrol Rename.
|
||||||
|
|
||||||
To remove the current deployment method, select \uicontrol Remove.
|
To remove the current deployment method, select \uicontrol Remove.
|
||||||
|
|
||||||
The packages are deployed on the Android device that you select in the
|
\QC deploys the packages on the Android device that you select in the
|
||||||
\l{Building for Multiple Platforms}{kit selector}. To add devices, select
|
\l{Building for Multiple Platforms}{kit selector}. To add devices, select
|
||||||
\uicontrol Manage.
|
\uicontrol Manage.
|
||||||
|
|
||||||
@@ -107,14 +79,13 @@
|
|||||||
\uicontrol Projects > \uicontrol {Build & Run} > \uicontrol Build >
|
\uicontrol Projects > \uicontrol {Build & Run} > \uicontrol Build >
|
||||||
\uicontrol {Build Android APK} > \uicontrol Details.
|
\uicontrol {Build Android APK} > \uicontrol Details.
|
||||||
|
|
||||||
\image qtcreator-android-build-apk-step.png "Build Android APK step"
|
\image qtcreator-build-settings-android-apk.webp {Build Android APK step}
|
||||||
|
|
||||||
The \c androiddeployqt tool uses the configuration information to
|
The \c androiddeployqt tool create APKs based on the settings. For more
|
||||||
create APKs. For more information about the available options, see
|
information about the available options, see \l{androiddeployqt}.
|
||||||
\l{androiddeployqt}.
|
|
||||||
|
|
||||||
You can view information about what the \c androiddeployqt tool is doing in
|
You can view information about what the \c androiddeployqt tool is doing in
|
||||||
\l {Compile Output}. To view additional information, select the
|
\l {Compile Output}. To view more information, select the
|
||||||
\uicontrol {Verbose output} check box.
|
\uicontrol {Verbose output} check box.
|
||||||
|
|
||||||
Select \uicontrol {Add debug server} to include the debug server binary
|
Select \uicontrol {Add debug server} to include the debug server binary
|
||||||
@@ -122,36 +93,31 @@
|
|||||||
|
|
||||||
\section3 Selecting API Level
|
\section3 Selecting API Level
|
||||||
|
|
||||||
In the \uicontrol {Android build platform SDK} field, you can select the
|
In the \uicontrol {Android build platform SDK} field, select the
|
||||||
API level to use for building the application. Usually, you should select
|
\l{What is API Level?}{API level} to use for building the application.
|
||||||
the highest API level available.
|
Usually, you should select the highest API level available.
|
||||||
|
|
||||||
\note For Qt 5.12.0 to 5.12.5 and Qt 5.13.0 to 5.13.1, Android build
|
Usually, you should use the highest version of the Android SDK
|
||||||
platform SDK 28 should be used. For more recent versions than Qt 5.13.1,
|
build-tools for building. If necessary, select another version
|
||||||
build platform SDK 29 or the most recent one should be used.
|
in the \uicontrol {Android build-tools version} field.
|
||||||
|
|
||||||
This field does not specify the minimum supported API level nor the target
|
|
||||||
API level, which you can specify in the Android manifest. See
|
|
||||||
\l{Editing Manifest Files}. For more information about Android API levels, see
|
|
||||||
\l{What is API Level?}.
|
|
||||||
|
|
||||||
\section3 Building AABs
|
\section3 Building AABs
|
||||||
|
|
||||||
For testing the application locally, use the APK format because
|
For testing the application locally, use the APK format because
|
||||||
the package can be uploaded directly to the device and run. For
|
\QC can install and run the package on the device. For distribution
|
||||||
distribution to the Google Play store, create an AAB by selecting
|
to the Google Play store, create an AAB by selecting
|
||||||
the \uicontrol {Build Android App Bundle (*.aab)} check box.
|
the \uicontrol {Build Android App Bundle (*.aab)} check box.
|
||||||
|
|
||||||
When building with CMake, you can view the selected ABIs in
|
When building with CMake, you can view the selected ABIs in
|
||||||
\uicontrol {Initial Configuration} in the \uicontrol CMake section.
|
\uicontrol {Initial Configuration} in the \uicontrol CMake section.
|
||||||
You can set additional ABIs as values of the \c ANDROID_ABI key:
|
You can set additional ABIs as values of the \c ANDROID_ABI key:
|
||||||
|
|
||||||
\image qtcreator-android-cmake-settings.png "CMake settings for building AABs"
|
\image qtcreator-android-cmake-settings.png {CMake settings for building AABs}
|
||||||
|
|
||||||
When building with Qbs or qmake, you can select the ABIs in the
|
When building with Qbs or qmake, you can select the ABIs in the
|
||||||
\uicontrol ABIs field in the \uicontrol {Build Steps}:
|
\uicontrol ABIs field in the \uicontrol {Build Steps}:
|
||||||
|
|
||||||
\image qtcreator-android-build-steps.png "qmake settings for building AABs"
|
\image qtcreator-android-build-steps.png {qmake settings for building AABs}
|
||||||
|
|
||||||
\section3 Signing Android Packages
|
\section3 Signing Android Packages
|
||||||
|
|
||||||
@@ -174,12 +140,12 @@
|
|||||||
certificate has information about the algorithm that is used to sign
|
certificate has information about the algorithm that is used to sign
|
||||||
the certificate, as well as the signature of the certificate.
|
the certificate, as well as the signature of the certificate.
|
||||||
|
|
||||||
The keystore is protected by a password. In addition, you can protect each
|
A password protects the keystore. In addition, you can protect each
|
||||||
alias with its individual password.
|
alias with its individual password.
|
||||||
|
|
||||||
When you sign an Android application, you must select a keystore that
|
When you sign an Android application, you must select a keystore that
|
||||||
has certificates and a certificate alias from the keystore. The public
|
has certificates and a certificate alias from the keystore. The signing
|
||||||
key (certificate) for the alias is embedded into the APK during signing.
|
process embeds the public key (certificate) for the alias into the APK.
|
||||||
|
|
||||||
To create a keystore and a self-signed certificate:
|
To create a keystore and a self-signed certificate:
|
||||||
|
|
||||||
@@ -250,8 +216,92 @@
|
|||||||
You can use the configuration options to specify all the settings you need
|
You can use the configuration options to specify all the settings you need
|
||||||
for the \c androiddeployqt tool. You only need an Android manifest file
|
for the \c androiddeployqt tool. You only need an Android manifest file
|
||||||
to specify Android-specific settings, such as the application icon.
|
to specify Android-specific settings, such as the application icon.
|
||||||
However, the manifest file is needed when you want to publish the package
|
However, you need the manifest file to publish the package in the Play Store.
|
||||||
in the Play Store.
|
For more information about manifest files, see
|
||||||
|
\l {Qt Android Manifest File Configuration}.
|
||||||
|
|
||||||
|
If you use CMake as the build system, you must specify the Android package
|
||||||
|
source directory, \c QT_ANDROID_PACKAGE_SOURCE_DIR, in the CMakeList.txt
|
||||||
|
file, as instructed in the \l{Locking Device Orientation}
|
||||||
|
{mobile device tutorial}.
|
||||||
|
|
||||||
|
To use \QC to create an Android manifest file and to open it in the Android
|
||||||
|
Manifest Editor:
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
|
||||||
|
\li Select \uicontrol Projects > \uicontrol Build >
|
||||||
|
\uicontrol {Build Android APK} > \uicontrol {Create Templates}.
|
||||||
|
|
||||||
|
\li Check the path in \uicontrol {Android package source directory}.
|
||||||
|
|
||||||
|
\image qtcreator-android-create-template.png {Create Template dialog}
|
||||||
|
|
||||||
|
\li Select \uicontrol {Copy the Gradle files to Android directory} if you
|
||||||
|
plan to extend the Java part of your Qt application.
|
||||||
|
|
||||||
|
\li Select \uicontrol Finish to copy the template files to the \c android
|
||||||
|
directory and to open the manifest file for editing.
|
||||||
|
|
||||||
|
\image qtcreator-android-manifest-editor-package.webp {Package info in Android Manifest Editor}
|
||||||
|
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
The following table summarizes the options you can set.
|
||||||
|
|
||||||
|
\table
|
||||||
|
\header
|
||||||
|
\li Option
|
||||||
|
\li Value
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Package name}
|
||||||
|
\li A valid \l{Package Names}{package name} for the application.
|
||||||
|
For example, \c {org.example.myapplication}.
|
||||||
|
An automatically generated Java launcher that is packaged with the
|
||||||
|
application into an APK launches the application.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Version code}
|
||||||
|
\li An internal version number for the package that determines whether
|
||||||
|
one version of the application is more recent than another.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Version name}
|
||||||
|
\li The version number that is visible to users.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Minimum required SDK}
|
||||||
|
\li The minimum API level required to run the application if you set it
|
||||||
|
manually in the manifest file.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Target SDK}
|
||||||
|
\li The targeted API level of the application if you set it manually in
|
||||||
|
the manifest file.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Application name}
|
||||||
|
\li The application's name.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Activity name}
|
||||||
|
\li An activity name.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Style extraction}
|
||||||
|
\li The method that Qt uses to determine which \l{Styling}{UI style}
|
||||||
|
to use.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Screen orientation}
|
||||||
|
\li How to determine \l{Screen Orientation}{screen orientation}.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Application icon}
|
||||||
|
\li Images to use as \l{Icons}{application icons} depending on screen
|
||||||
|
resolution.
|
||||||
|
\row
|
||||||
|
\li \uicontrol {Splash screen}
|
||||||
|
\li Images to display as \l{Splash Screens}{splash screens} depending on
|
||||||
|
the screen orientation and resolution.
|
||||||
|
\row
|
||||||
|
\li \uicontrol Permissions
|
||||||
|
\li The \l{Setting Permissions}{permissions} that the application needs.
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
On the top header, select the \uicontrol {XML Source} tab to edit the file
|
||||||
|
in XML format.
|
||||||
|
|
||||||
\section2 Package Names
|
\section2 Package Names
|
||||||
|
|
||||||
@@ -378,7 +428,7 @@
|
|||||||
\li Locks the orientation to its current rotation, whatever that is.
|
\li Locks the orientation to its current rotation, whatever that is.
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
\section2 Icons and Splash Screens
|
\section2 Icons
|
||||||
|
|
||||||
You can set different images to be shown as application icons and splash
|
You can set different images to be shown as application icons and splash
|
||||||
screens on low, medium, high, and extra high DPI displays. The following
|
screens on low, medium, high, and extra high DPI displays. The following
|
||||||
@@ -399,16 +449,17 @@
|
|||||||
high, and extra high DPI displays, as needed. Alternatively, set the icons
|
high, and extra high DPI displays, as needed. Alternatively, set the icons
|
||||||
for each resolution separately.
|
for each resolution separately.
|
||||||
|
|
||||||
\image qtcreator-android-manifest-editor-app-icon.png "Application icons in Android Manifest Editor"
|
\image qtcreator-android-manifest-editor-app-icon.webp {Application icons in Android Manifest Editor}
|
||||||
|
|
||||||
|
\section2 Splash Screens
|
||||||
|
|
||||||
Specify settings for splash screens in the \uicontrol {Splash screen} tab.
|
Specify settings for splash screens in the \uicontrol {Splash screen} tab.
|
||||||
Select images to display as splash screens depending on the device
|
Select images to display as splash screens depending on the device
|
||||||
orientation and screen resolution.
|
orientation and screen resolution.
|
||||||
|
|
||||||
\image qtcreator-android-manifest-editor-splash-screen.png "Splash screens in Android Manifest Editor"
|
\image qtcreator-android-manifest-editor-splash-screen.webp {Splash screens in Android Manifest Editor}
|
||||||
|
|
||||||
By default, the splash screen is hidden automatically
|
By default, drawing an activity hides the splash screen. To keep it visible until
|
||||||
when an activity is drawn. To keep it visible until
|
|
||||||
\l{https://doc.qt.io/qt-6/qnativeinterface-qandroidapplication.html#hideSplashScreen}
|
\l{https://doc.qt.io/qt-6/qnativeinterface-qandroidapplication.html#hideSplashScreen}
|
||||||
{QNativeInterface::QAndroidApplication::hideSplashScreen()} is
|
{QNativeInterface::QAndroidApplication::hideSplashScreen()} is
|
||||||
called, select the \uicontrol {Sticky splash screen} check box.
|
called, select the \uicontrol {Sticky splash screen} check box.
|
||||||
@@ -424,102 +475,22 @@
|
|||||||
|
|
||||||
Select \uicontrol {Clear All} to reset all settings or remove all images.
|
Select \uicontrol {Clear All} to reset all settings or remove all images.
|
||||||
|
|
||||||
\section2 Android Manifest Editor
|
\section2 Setting Permissions
|
||||||
|
|
||||||
If you use qmake as the build system, you can create an Android manifest
|
Starting from Android 6.0 (API 23), applications have to request permissions
|
||||||
file and edit it in \QC.
|
at runtime (see \l{QtAndroidPrivate::requestPermission()}). For
|
||||||
|
lower Android API levels, users have to grant the permissions when they
|
||||||
To create an Android manifest file and to open it in the Android Manifest
|
|
||||||
Editor:
|
|
||||||
|
|
||||||
\list 1
|
|
||||||
|
|
||||||
\li Select \uicontrol Projects > \uicontrol Build >
|
|
||||||
\uicontrol {Build Android APK} > \uicontrol {Create Templates}.
|
|
||||||
|
|
||||||
\li Check the path in \uicontrol {Android package source directory}.
|
|
||||||
|
|
||||||
\image qtcreator-android-create-template.png "Create Template dialog"
|
|
||||||
|
|
||||||
\li Select \uicontrol {Copy the Gradle files to Android directory} if you
|
|
||||||
plan to extend the Java part of your Qt application.
|
|
||||||
|
|
||||||
\li Select \uicontrol Finish to copy the template files to the \c android
|
|
||||||
directory and to open the manifest file for editing.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Package name} field, enter a valid
|
|
||||||
\l{Package Names}{package name} for the application.
|
|
||||||
For example, \c {org.example.myapplication}.
|
|
||||||
The application is launched by an automatically generated Java launcher
|
|
||||||
that is packaged with the application into an Android package (.apk).
|
|
||||||
|
|
||||||
\image qtcreator-android-manifest-editor-package.png "Package info in Android Manifest Editor"
|
|
||||||
|
|
||||||
\li You can specify an internal version number for the package in the
|
|
||||||
\uicontrol {Version code} field. It is used to determine whether one version of
|
|
||||||
the application is more recent than another. In the \uicontrol {Version name}
|
|
||||||
field, specify the version number that is shown to users.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Minimum required SDK} field, select the minimum API level
|
|
||||||
required to run the application. The minimum supported API level for \QC is
|
|
||||||
android-9. However, Qt versions might have different minimum API levels, and
|
|
||||||
therefore \QC does not allow you to select an API level that the Qt version
|
|
||||||
specified for the kit does not support.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Target SDK} field, select the targeted API level of the
|
|
||||||
application. This affects the activation of some compatibility features in
|
|
||||||
the OS. The value used by the \c androiddeployqt tool by default is 14, which
|
|
||||||
means that the overflow button in the system navigation bar will not be
|
|
||||||
enabled by default.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Application name} field, set the application's name.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Activity name} field, set an activity name.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Style extraction} field, set the method that Qt
|
|
||||||
uses to \l{Styling}{determine which UI style to use}.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Screen orientation} field, select the option for
|
|
||||||
determining \l{Screen Orientation}{screen orientation}.
|
|
||||||
|
|
||||||
\li In \uicontrol {Application icon}, specify images to use as application
|
|
||||||
icons depending on screen resolution.
|
|
||||||
|
|
||||||
\li In \uicontrol {Splash screen}, select images to display as splash
|
|
||||||
screens depending on the screen orientation and resolution.
|
|
||||||
|
|
||||||
\li In \uicontrol {Android services}, select \uicontrol Add to add a service.
|
|
||||||
You must enter at least a service class name for a new service. If you select
|
|
||||||
\uicontrol {Run in external process}, you also need to enter a process name.
|
|
||||||
If you select \uicontrol {Run in external library}, you need to enter a library name.
|
|
||||||
Service arguments are mandatory for a service that is not run in an external
|
|
||||||
library. For more information about writing service code and structure of services,
|
|
||||||
see \l{Android Services}.
|
|
||||||
|
|
||||||
\image qtcreator-android-manifest-editor-services.png "Android services in Android Manifest Editor"
|
|
||||||
|
|
||||||
\li In the \uicontrol Permissions field, you can specify the permissions that your
|
|
||||||
application needs. Starting from Android 6.0 (API 23), permissions have to be
|
|
||||||
requested at runtime (see \l{QtAndroidPrivate::requestPermission()}). For
|
|
||||||
lower Android API levels, users are asked to grant the permissions when they
|
|
||||||
install the application. Android OS then grants the application access to the
|
install the application. Android OS then grants the application access to the
|
||||||
appropriate data and features.
|
appropriate data and features.
|
||||||
|
|
||||||
\image qtcreator-android-manifest-editor-permissions.png "Permissions in Android Manifest Editor"
|
\image qtcreator-android-manifest-editor-permissions.webp {Permissions in Android Manifest Editor}
|
||||||
|
|
||||||
\li Select the \uicontrol {Include default permissions for Qt modules} and
|
Select the \uicontrol {Include default permissions for Qt modules} and
|
||||||
\uicontrol {Include default features for Qt modules} check boxes to add the
|
\uicontrol {Include default features for Qt modules} check boxes to add the
|
||||||
permissions needed by Qt libraries. This can be
|
permissions needed by Qt libraries. This can be
|
||||||
\c {android.permission.WRITE_EXTERNAL_STORAGE} for \l{Qt Core} or
|
\c {android.permission.WRITE_EXTERNAL_STORAGE} for \l{Qt Core} or
|
||||||
\c {android.permission.ACCESS_COARSE_LOCATION} for
|
\c {android.permission.ACCESS_BACKGROUND_LOCATION} for \l{Qt Positioning}.
|
||||||
\l{https://doc.qt.io/qt-5.15/qtlocation-index.html}{Qt Location}.
|
|
||||||
|
|
||||||
\li To add a permission, select it from the list, and then click \uicontrol Add.
|
|
||||||
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
On the top header, select the \uicontrol {XML Source} tab to edit the file
|
|
||||||
in XML format.
|
|
||||||
|
|
||||||
|
To add a permission, select it from the list, and then click \uicontrol Add.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|