Docs: update Android docs to reflect the latest changes
Docs affected: * Connecting Android Devices * Deploying Applications to Android Devices * Specifying Run Settings for Android Devices Task-number: QTBUG-80390 Change-Id: I17fecd4d947644d8cc6071af68addbc2199ad82e Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
1
dist/changes-4.12.0.md
vendored
@@ -202,6 +202,7 @@ Platforms
|
|||||||
|
|
||||||
### Android
|
### Android
|
||||||
|
|
||||||
|
* Discontinued support for Ministro
|
||||||
* Added auto-detection of Java JDK (QTCREATORBUG-23407)
|
* Added auto-detection of Java JDK (QTCREATORBUG-23407)
|
||||||
* Added option to automatically download and install required Android tools (QTCREATORBUG-23285)
|
* Added option to automatically download and install required Android tools (QTCREATORBUG-23285)
|
||||||
* Added option to register multiple NDKs (QTCREATORBUG-23286)
|
* Added option to register multiple NDKs (QTCREATORBUG-23286)
|
||||||
|
BIN
doc/qtcreator/images/qtcreator-android-avd-manager.png
Normal file
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
BIN
doc/qtcreator/images/qtcreator-android-create-avd.png
Normal file
After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
BIN
doc/qtcreator/images/qtcreator-options-android-main.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
doc/qtcreator/images/qtcreator-options-android-sdk-tools.png
Normal file
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 13 KiB |
@@ -36,50 +36,42 @@
|
|||||||
|
|
||||||
\title Connecting Android Devices
|
\title Connecting Android Devices
|
||||||
|
|
||||||
You can connect Android devices to the development PC to run, debug,
|
You can connect Android devices to the development PC to build, run, debug,
|
||||||
and analyze applications built for them from \QC. Devices with Android
|
and analyze applications from \QC. Devices with Android
|
||||||
version 4.1 (API level 16) or later are supported.
|
version 4.1 (API level 16) or later are supported.
|
||||||
|
|
||||||
If you have a tool chain for building applications for Android devices
|
If you have a tool chain for building applications for Android devices
|
||||||
installed on the development PC, you can add it to \QC. You can then add a
|
installed on the development PC, you can add it to \QC. You can then add a
|
||||||
\l{glossary-buildandrun-kit}{kit}
|
\l{glossary-buildandrun-kit}{kit}
|
||||||
with the Android device type, the tool chain, and the Qt version for Android,
|
with the tool chain, and the Qt version for Android for the device's architecture,
|
||||||
to build applications for and run them on Android devices. You can also
|
to build applications for and run them on Android devices. Starting from Qt 5.14.0,
|
||||||
allow \QC to automatically configure the kit.
|
Qt for Android package contains all the architectures (ABIs) installed as one.
|
||||||
|
You can also allow \QC to automatically create kits for installed Qt version
|
||||||
|
and tool chains.
|
||||||
|
|
||||||
The Android Debug Bridge (adb) command line tool is integrated to \QC to
|
The Android Debug Bridge (adb) command line tool is integrated to \QC to
|
||||||
enable you to deploy applications to connected Android devices, to run
|
enable you to deploy applications to connected Android devices, to run
|
||||||
the applications on them, and to read logs from them. It includes a client
|
them, and to read their logs. It includes a client and server that run on
|
||||||
and server that run on the development host and a daemon that runs on the
|
the development host and a daemon that runs on the emulator or device.
|
||||||
emulator or device.
|
|
||||||
|
|
||||||
\section1 Requirements
|
\section1 Requirements
|
||||||
|
|
||||||
To use \QC to develop Qt applications for Android, you need the following:
|
To use \QC to develop Qt applications for Android, you need the following:
|
||||||
|
|
||||||
\list
|
\list
|
||||||
|
\li \l{https://www.oracle.com/java/technologies/javase-jdk8-downloads.html}
|
||||||
\li \l{http://www.oracle.com/technetwork/java/javase/downloads/index.html}
|
{Java SE Development Kit (JDK)} version 6 up to 8.
|
||||||
{Java SE Development Kit (JDK)} version 6, or later.
|
|
||||||
You can also use \l{http://openjdk.java.net/}{OpenJDK} on Linux.
|
You can also use \l{http://openjdk.java.net/}{OpenJDK} on Linux.
|
||||||
|
|
||||||
\note Android SDK Tools have issues with JDK versions later than 8.
|
\note Android SDK Tools have issues with JDK versions later than 8.
|
||||||
|
|
||||||
\li \l{http://www.gradle.org}{Gradle} for building application packages
|
\li \l{http://www.gradle.org}{Gradle} for building application packages
|
||||||
(APK) and app bundles (AAB) for Android devices. Gradle is delivered
|
(APK) and app bundles (AAB) for Android devices. Gradle is delivered
|
||||||
with Qt 5.9, and later. Because Gradle scripts are not delivered
|
with Qt 5.9, and later, because Gradle scripts are not delivered
|
||||||
with Android SDK tools since version 26.0.0, they are delivered
|
with Android SDK tools since version 26.0.0.
|
||||||
with Qt 5.9 and 5.6.3.
|
|
||||||
|
|
||||||
\note Using Ant to build APKs is no longer supported.
|
\note Using Ant to build APKs is no longer supported.
|
||||||
|
|
||||||
\li A tool chain for building applications for Android devices provided
|
|
||||||
by the \l{http://developer.android.com/tools/sdk/ndk/index.html}
|
|
||||||
{Android NDK} from Google.
|
|
||||||
|
|
||||||
\note To develop with Qt 5.14.0 or later, you need Android NDK r20
|
|
||||||
or later.
|
|
||||||
|
|
||||||
\li \l{http://developer.android.com/sdk/index.html}{Android SDK Tools}
|
\li \l{http://developer.android.com/sdk/index.html}{Android SDK Tools}
|
||||||
|
|
||||||
The following Android SDK packages and tools are required for
|
The following Android SDK packages and tools are required for
|
||||||
@@ -89,47 +81,94 @@
|
|||||||
\li Platform tools
|
\li Platform tools
|
||||||
\li Build tools
|
\li Build tools
|
||||||
\li At least one SDK platform
|
\li At least one SDK platform
|
||||||
|
\li The \l{http://developer.android.com/tools/sdk/ndk/index.html}
|
||||||
|
{Android NDK} from Google that provides the tool chain for
|
||||||
|
building applications for Android devices. For a detailed
|
||||||
|
list of Qt versions and their recommended NDK versions,
|
||||||
|
see \l{https://doc-snapshots.qt.io/qt5-5.14/android-getting-started.html}
|
||||||
|
{The Android NDK}.
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\li On Windows, you also need the following:
|
\li On Windows, you also need the Android Debug Bridge (ADB) driver
|
||||||
|
on the Windows platform to enable USB debugging. The default USB
|
||||||
\list
|
driver on Windows does not allow debugging. For more information
|
||||||
|
about installing ADB, see \l {ADB windows driver}
|
||||||
\li Android Debug Bridge (ADB) driver on the Windows platform to
|
{ADB driver installation}.
|
||||||
enable USB debugging. The default USB driver on Windows does not
|
|
||||||
allow debugging. For more information about obtaining the USB
|
|
||||||
driver, see \l{http://developer.android.com/sdk/win-usb.html}.
|
|
||||||
|
|
||||||
After installing the driver, try running a few basic
|
|
||||||
\l{http://developer.android.com/tools/help/adb.html}{adb}
|
|
||||||
commands to check that your device responds to them.
|
|
||||||
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
\note When using the command line tools instead of Android Studio,
|
|
||||||
it is recommended to create an empty folder and extract the
|
|
||||||
downloaded archive into this folder.
|
|
||||||
The sdkmanager will install downloaded packages next to the
|
|
||||||
\c tools folder that contains all command line tools.
|
|
||||||
You must specify the path to the folder where you extracted the
|
|
||||||
files as Android SDK location inside the Android settings.
|
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\section1 Setting Up the Development Environment
|
\section1 Setting Up the Development Environment
|
||||||
|
|
||||||
You must download and install the latest Android NDK and SDK, and then
|
To build Android applications with Qt, install Qt for Android 5.2, or later.
|
||||||
update or install the tools and packages needed for development. However,
|
|
||||||
if your Qt version is earlier than v5.9, use the SDK tools package v25.2.5
|
|
||||||
or earlier.
|
|
||||||
|
|
||||||
The SDK tool used to update and install the other SDK tools and packages
|
\note You can build a 64-bit version of Qt for Android yourself. However,
|
||||||
depends on the Android SDK Tools version that you have installed:
|
for such a Qt version, the minimum required Android version on devices
|
||||||
|
is 5.0 (API level 21).
|
||||||
|
|
||||||
|
For more information, see \l{Qt for Android}.
|
||||||
|
|
||||||
|
Download and install the latest Android SDK, and then install
|
||||||
|
or update the NDKs, tools and packages needed for development.
|
||||||
|
|
||||||
|
Starting from \QC 4.12, \QC offers to automatically set up your Android
|
||||||
|
environment and install all the necessary packages and Tools, then
|
||||||
|
creating debuggers, tool chains, and kits. For more information,
|
||||||
|
see \l {Specifying Android Device Settings}.
|
||||||
|
|
||||||
|
Alternatively, use the Android SDK command line tools to install
|
||||||
|
the required packages. In that case, it is recommended to create an
|
||||||
|
empty folder and extract the downloaded archive into this folder.
|
||||||
|
|
||||||
|
\note The recommended Android SDK Tools version is 25.3.0, or later. The version
|
||||||
|
25.2.5, or earlier, can be used but it is not advised because it cannot be
|
||||||
|
fully integrated with \QC.
|
||||||
|
|
||||||
\list
|
\list
|
||||||
|
\li Android SDK Tools version 25.3.0, or later
|
||||||
|
|
||||||
|
This allows using the
|
||||||
|
\l{https://developer.android.com/studio/command-line/sdkmanager.html}
|
||||||
|
{sdkmanager} command line tool for SDK package management and the
|
||||||
|
\l{https://developer.android.com/studio/command-line/avdmanager.html}
|
||||||
|
{avdmanager} tool for Android Virtual Device (AVD) management.
|
||||||
|
|
||||||
|
The sdkmanager will install downloaded packages next to the \c tools
|
||||||
|
folder that contains all command line tools. You must specify the path
|
||||||
|
to the folder where you extracted the files as Android SDK location
|
||||||
|
inside the Android settings.
|
||||||
|
|
||||||
|
To install those packages, use the following command:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
./sdkmanager "platform-tools" "platforms;android-29" "build-tools;29.0.2" "ndk-bundle"
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
For Qt 5.12.0 to 5.12.5 and Qt 5.13.0 to 5.13.1, the following
|
||||||
|
should be installed instead:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
./sdkmanager "platform-tools" "platforms;android-29" "build-tools;28.0.2" "ndk;19.2.5345600"
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\target ADB windows driver
|
||||||
|
Under Windows, Google's USB drivers can be installed by running:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
sdkmanager.bat "extras;google;usb_driver"
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
For more information about altenative methods of obtaining the USB
|
||||||
|
driver, see \l{http://developer.android.com/sdk/win-usb.html}.
|
||||||
|
After the package installation is complete, install the driver from
|
||||||
|
\c{<ANDROID_SDK_ROOT>/extras/google/usb_driver}. Try running a few basic
|
||||||
|
\l{http://developer.android.com/tools/help/adb.html}{adb} commands now
|
||||||
|
and check whether your Android device responds to them.
|
||||||
|
|
||||||
\li Android SDK Tools version 25.2.5, or earlier
|
\li Android SDK Tools version 25.2.5, or earlier
|
||||||
|
|
||||||
|
If your Qt version is earlier than v5.9, use this SDK tools version.
|
||||||
|
The SDK tool used to install and update the other SDK tools and packages
|
||||||
|
depends on the Android SDK Tools version that you have installed:
|
||||||
|
|
||||||
Use the
|
Use the
|
||||||
\l{https://developer.android.com/studio/tools/help/android.html}
|
\l{https://developer.android.com/studio/tools/help/android.html}
|
||||||
{android} tool that comes with the SDK Tools package. For example,
|
{android} tool that comes with the SDK Tools package. For example,
|
||||||
@@ -139,54 +178,97 @@
|
|||||||
./android update sdk
|
./android update sdk
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\li Android SDK Tools version 25.3.0, or later
|
|
||||||
|
|
||||||
Use the
|
|
||||||
\l{https://developer.android.com/studio/command-line/sdkmanager.html}
|
|
||||||
{sdkmanager} command line tool for SDK package management and the
|
|
||||||
\l{https://developer.android.com/studio/command-line/avdmanager.html}
|
|
||||||
{avdmanager} tool for Android Virtual Device (AVD) management.
|
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
In addition, you must install Qt for Android as part of Qt 5.2, or later.
|
|
||||||
|
|
||||||
\note You can build a 64-bit version of Qt for Android yourself. However,
|
|
||||||
for such a Qt version, the minimum required Android version on devices
|
|
||||||
is 5.0 (API level 21).
|
|
||||||
|
|
||||||
For more information, see \l{Qt for Android}.
|
|
||||||
|
|
||||||
\section2 Specifying Android Device Settings
|
\section2 Specifying Android Device Settings
|
||||||
|
|
||||||
To configure connections between \QC and Android devices:
|
To configure connections to Android devices and general Android settings:
|
||||||
|
|
||||||
\list 1
|
\list 1
|
||||||
|
|
||||||
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices >
|
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices >
|
||||||
\uicontrol Android.
|
\uicontrol Android.
|
||||||
|
|
||||||
\image qtcreator-options-android1.png "Android options"
|
\image qtcreator-options-android-main.png "Android options"
|
||||||
|
|
||||||
\li In the \uicontrol {JDK location} field, add the path to the JDK.
|
\li In the \uicontrol {JDK location} field, set the path to the JDK.
|
||||||
|
|
||||||
Select the \inlineimage icons/download-icon.png
|
By default, \QC tries to find any valid JDK/OpenJDK installation.
|
||||||
(\uicontrol Download) button to go to the site where you can
|
However, if none is found, you must set it manually. Click the
|
||||||
download the JDK. \QC checks the JDK installation and reports
|
\inlineimage icons/download-icon.png
|
||||||
errors.
|
(\uicontrol Download) button to open the JDK download web page in the
|
||||||
|
default browser. \QC checks the JDK installation and reports errors.
|
||||||
|
|
||||||
\li In the \uicontrol {Android Settings} group, add paths to the Android
|
\li In the \uicontrol {Android Settings} group, set the path to the
|
||||||
NDK and SDK.
|
Android SDK Tools.
|
||||||
|
|
||||||
Select \inlineimage icons/download-icon.png
|
Select \inlineimage reload_gray.png
|
||||||
to go to the sites where you can download the Android NDK and SDK.
|
button to automatically download and extract the Android SDK Tools
|
||||||
|
to the selected path. This will do the following:
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
\li Download and extract the Android SDK Tools.
|
||||||
|
\li Install or update the essential packages such as NDKs,
|
||||||
|
build tools, platform tools.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
The SDK Tools download URL, the essential packages list, and the
|
||||||
|
appropriate NDK for each Qt version are defined in a JSON
|
||||||
|
configuration file. The file is located under the user's \QC
|
||||||
|
resource folder:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
# Linux and macOS
|
||||||
|
~/.config/QtProject/qtcreator/android/sdk_definitions.json
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
C:\Users\Username\AppData\Local\QtProject\qtcreator\android\sdk_definitions.json
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
For example, the SDK configuration file defines 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:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
"specific_qt_versions": [
|
||||||
|
{
|
||||||
|
"versions": ["5.12.[0-5]", "5.13.[0-1]"],
|
||||||
|
"sdk_essential_packages": ["build-tools;28.0.2", "ndk;19.2.5345600"],
|
||||||
|
"ndk_path": "ndk/19.2.5345600"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
The latest version of the configuration file that is up-to-date
|
||||||
|
with the Android SDK and NDK changes is found
|
||||||
|
\l{https://code.qt.io/cgit/qt-creator/qt-creator.git/plain/share/qtcreator/android/sdk_definitions.json}{here}.
|
||||||
|
|
||||||
|
The installed NDK versions are listed below the SDK path.
|
||||||
|
The items with a lock icon are versions installed from the SDK Manager,
|
||||||
|
and can only be modified from the SDK Manager tab. For more information,
|
||||||
|
see \l{Managing Android SDK Packages}. Custom NDK paths can be manually
|
||||||
|
added to the global list of NDKs via the \uicontrol Add button.
|
||||||
|
This creates custom tool chains and debuggers associated to
|
||||||
|
that NDK, which can be used to create custom kits defined by the user.
|
||||||
|
|
||||||
|
To manually download the SDK Tools, select \inlineimage icons/download-icon.png
|
||||||
|
to open the SDK or NDK download web page in the default browser.
|
||||||
|
|
||||||
The SDK Manager checks the Android NDK and SDK installations,
|
The SDK Manager checks the Android NDK and SDK installations,
|
||||||
reports errors, and offers to install the necessary packages.
|
reports errors, and offers to install the necessary packages.
|
||||||
|
|
||||||
\image qtcreator-options-android2.png "Android NDK and SDK checks"
|
\image qtcreator-options-android-sdk-tools.png "Android NDK and SDK checks"
|
||||||
|
|
||||||
For more information, see \l {Managing Android SDK Packages}.
|
\li In the \uicontrol {Android OpenSSL} group, set the path to the
|
||||||
|
prebuilt OpenSSL libraries.
|
||||||
|
|
||||||
|
For Qt applications that require OpenSSL support, \QC allows to
|
||||||
|
quickly add the \l{https://marketplace.qt.io/products/android-openssl-support}
|
||||||
|
{Android OpenSSL support} to your project. For more details, see
|
||||||
|
\l{Adding External Libraries}.
|
||||||
|
|
||||||
|
Select \inlineimage icons/download-icon.png
|
||||||
|
to download the OpenSSL repository to the selected path. If the
|
||||||
|
automatic download fails, the download web page opens for manual download.
|
||||||
|
|
||||||
\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
|
||||||
@@ -213,12 +295,13 @@
|
|||||||
Debugging is enabled in different ways on different Android devices.
|
Debugging is enabled 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
|
||||||
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.
|
\uicontrol About several times. For more details, check
|
||||||
|
\l{https://developer.android.com/studio/debug/dev-options}{Configure on-device developer options}.
|
||||||
|
|
||||||
\li Connect the Android device to the development PC with a USB cable.
|
\li Connect the Android device to the development PC with a USB cable.
|
||||||
You might be asked to select a device in the
|
You might be asked to select a device in the
|
||||||
\uicontrol {Select Android Devices} dialog.
|
\l{Selecting Android Devices}{Select Android Devices} dialog.
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\section2 Managing Android SDK Packages
|
\section2 Managing Android SDK Packages
|
||||||
@@ -230,11 +313,12 @@
|
|||||||
removing SDK packages. You can still use sdkmanager for advanced SDK
|
removing SDK packages. You can still use sdkmanager for advanced SDK
|
||||||
management.
|
management.
|
||||||
|
|
||||||
When you add paths to the Anroid NDK and SDK in the device options, the
|
After you set the path to the Anroid SDK in \uicontrol Tools >
|
||||||
|
\uicontrol Options > \uicontrol Devices > \uicontrol Android, the
|
||||||
SDK Manager checks that all the necessary SDK packages have been installed.
|
SDK Manager checks that all the necessary SDK packages have been installed.
|
||||||
If packages are missing or updates are needed, the SDK Manager offers to
|
If packages are missing or updates are needed, the SDK Manager offers to
|
||||||
add and remove packages, as necessary. Before taking action, it prompts you
|
add or remove those packages. Before taking action, it prompts
|
||||||
to accept the changes it is about to make. In addition, it prompts you to
|
you to accept the changes it is about to make. In addition, it prompts you to
|
||||||
accept Google licenses, as necessary.
|
accept Google licenses, as necessary.
|
||||||
|
|
||||||
To view the installed Android SDK packages, select \uicontrol Tools >
|
To view the installed Android SDK packages, select \uicontrol Tools >
|
||||||
@@ -261,13 +345,40 @@
|
|||||||
different Android SDK Tools versions. If you have the native SDK Manager
|
different Android SDK Tools versions. If you have the native SDK Manager
|
||||||
installed, you can open it by selecting \uicontrol {Native SDK Manager}.
|
installed, you can open it by selecting \uicontrol {Native SDK Manager}.
|
||||||
|
|
||||||
|
\section1 Managing Android Virtual Devices (AVD)
|
||||||
|
|
||||||
|
A list of AVDs is shown under \uicontrol Tools > \uicontrol Options >
|
||||||
|
\uicontrol Devices > \uicontrol Android > \uicontrol {AVD Manager}. This
|
||||||
|
works only with a valid \uicontrol {SDK Tools} path being set. The value in
|
||||||
|
\uicontrol {System/data partition size} is used to set the emulator's system
|
||||||
|
partition size upon execution with \uicontrol {Start}.
|
||||||
|
|
||||||
|
\image qtcreator-android-avd-manager.png "Android NDK and SDK checks"
|
||||||
|
|
||||||
|
\section1 Creating a New AVD
|
||||||
|
|
||||||
|
To create new virtual devices, select \uicontrol Tools > \uicontrol Options >
|
||||||
|
\uicontrol Devices > \uicontrol Android > \uicontrol {AVD Manager} > \uicontrol {Add}.
|
||||||
|
|
||||||
|
In the \uicontrol {Create new AVD} dialog, you can create a new custom AVD
|
||||||
|
by setting the name, device type, skin, architecture, API level, and SD card
|
||||||
|
size. You need to have a valid \uicontrol {System Image} installed
|
||||||
|
before using this dialog, either from \QC's \uicontrol {SDK Manager} tab or
|
||||||
|
from Android Studio.
|
||||||
|
|
||||||
|
For more advanced options for creating a new AVD, use the command-line tool
|
||||||
|
\l{https://developer.android.com/studio/command-line/avdmanager.html}{avdmanager},
|
||||||
|
or use Android Studio's native AVD Manager's UI.
|
||||||
|
|
||||||
|
\image qtcreator-android-create-avd.png "Android NDK and SDK checks"
|
||||||
|
|
||||||
\section1 Selecting Android Devices
|
\section1 Selecting Android Devices
|
||||||
|
|
||||||
When you deploy an application to an Android device with Android
|
When you deploy an application to an Android device with Android
|
||||||
version 4.2 or later, the \uicontrol {Select Android Devices} dialog opens. It
|
version 4.2 (API 16) or later, the \uicontrol {Select Android Device} dialog
|
||||||
lists the devices that are connected to the development PC. and their
|
opens. It lists the devices that are connected to the development PC, as
|
||||||
status. You can select devices from the \uicontrol {Compatible Devices} list for
|
well as AVDs, and their status. You can select devices or AVDs from the
|
||||||
deployment.
|
\uicontrol {Compatible Devices} list for deployment.
|
||||||
|
|
||||||
If \QC determines that a device is not ready for deployment, it places the
|
If \QC determines that a device is not ready for deployment, it places the
|
||||||
device in the \uicontrol {Incompatible Devices} list, with information about the
|
device in the \uicontrol {Incompatible Devices} list, with information about the
|
||||||
@@ -276,34 +387,41 @@
|
|||||||
\uicontrol {Refresh Device List}. The device is moved to the
|
\uicontrol {Refresh Device List}. The device is moved to the
|
||||||
\uicontrol {Compatible Devices} list and you can select it for deployment.
|
\uicontrol {Compatible Devices} list and you can select it for deployment.
|
||||||
|
|
||||||
Other reasons for placing a device on the \uicontrol {Incompatible Devices} are
|
Other reasons for showing a device in \uicontrol {Incompatible Devices} are
|
||||||
that the Android version on the device is too old or that the tool chain
|
that the Android version on the device is too old or that the tool chain
|
||||||
used for building does not match the Android architecture on the device
|
used for building does not match the Android architecture on the device
|
||||||
(for example, you cannot deploy an ARM build on an x86 device).
|
(for example, you cannot deploy an ARM build on an x86 device).
|
||||||
|
|
||||||
\image qtcreator-android-select-devices.png "Select Android Devices dialog"
|
\image qtcreator-android-select-devices.png "Select Android Devices dialog"
|
||||||
|
|
||||||
AVDs are also listed. To create new AVDs, select
|
To \l{Creating a New AVD}{create a new AVD}, select \uicontrol {Create Android Virtual Device}.
|
||||||
\uicontrol {Create Android Virtual Device}.
|
|
||||||
|
|
||||||
To set a device as the default device for a particular Android architecture,
|
To set a device as the default device for a particular Android architecture
|
||||||
select the \uicontrol {Always use this device for architecture} check box. The
|
for the current project, select the \uicontrol {Always use this device for architecture}
|
||||||
\uicontrol {Select Android Devices} dialog will not appear until you switch to
|
check box. The \uicontrol {Select Android Devices} dialog will not appear
|
||||||
another project or restart \QC.
|
until you switch to another project or restart \QC.
|
||||||
|
|
||||||
\section1 Using the Android Emulator
|
\section1 Using the Android Emulator
|
||||||
|
|
||||||
To run your application on the Android Emulator, you must create Android
|
To run your application on the Android Emulator, you must have an Android
|
||||||
virtual devices (AVD). Select \uicontrol Tools > \uicontrol Options >
|
virtual device (AVD). For more information about creating a new one, see
|
||||||
\uicontrol Devices > \uicontrol Android >
|
\l{Creating a New AVD}. If you run an application without a device connected to the
|
||||||
\uicontrol Add. If you run an application without a device connected to the
|
|
||||||
development PC and without an AVD specified, \QC asks you to add an AVD.
|
development PC and without an AVD specified, \QC asks you to add an AVD.
|
||||||
|
|
||||||
To manage AVDs, select \uicontrol {Start AVD Manager}.
|
For Android SDK Tools 25.2.5, or earlier, select \uicontrol {Native AVD Manager}
|
||||||
|
to manage AVDs.
|
||||||
|
|
||||||
\note The Android Emulator has a bug that prevents it from starting on some
|
\note The Android Emulator has a bug that prevents it from starting on some
|
||||||
systems. If the Android Emulator does not start, you can try starting it
|
systems. If the Android Emulator does not start, you can try starting it
|
||||||
manually by running the \c {emulator-arm} command from the command line.
|
manually by running the following commands:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
cd <ANDROID_SDK>/emulator
|
||||||
|
./emulator -avd <AVD_NAME>
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
For more information, see \l{https://developer.android.com/studio/run/emulator-commandline}
|
||||||
|
{Start the emulator from the command line}.
|
||||||
|
|
||||||
\section1 Debugging on Android Devices
|
\section1 Debugging on Android Devices
|
||||||
|
|
||||||
@@ -312,6 +430,9 @@
|
|||||||
|
|
||||||
\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 the \uicontrol Output
|
running. If the following message is displayed in the \uicontrol Output
|
||||||
pane, close Android Studio and try again: \e {Ignoring second debugger -
|
pane, close Android Studio and try again:
|
||||||
accepting and dropping.}
|
|
||||||
|
\badcode
|
||||||
|
Ignoring second debugger -accepting and dropping.
|
||||||
|
\endcode
|
||||||
*/
|
*/
|
||||||
|
@@ -37,6 +37,18 @@
|
|||||||
\uicontrol {Activity manager start options} field. However, if the default
|
\uicontrol {Activity manager start options} field. However, if the default
|
||||||
options conflict with the added options, the application might not start.
|
options conflict with the added options, the application might not start.
|
||||||
|
|
||||||
|
The default arguments for the Activity manager for a normal run:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
am start -n org.qtproject.example.notification/org.qtproject.qt5.android.bindings.QtActivity
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
The default arguments for the Activity manager for the debugger mode:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
am start -n org.qtproject.example.notification/org.qtproject.qt5.android.bindings.QtActivity -D
|
||||||
|
\endcode
|
||||||
|
|
||||||
For example, to run the application as a particular user, enter the start
|
For example, to run the application as a particular user, enter the start
|
||||||
option \c {--user 10}, where \c 10 is the user ID of the user account.
|
option \c {--user 10}, where \c 10 is the user ID of the user account.
|
||||||
|
|
||||||
|
@@ -46,19 +46,14 @@
|
|||||||
|
|
||||||
\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 As a minimal APK that contains a dependency to the Ministro tool.
|
|
||||||
The Ministro tool downloads the necessary Qt libraries from a
|
|
||||||
repository of your choice.
|
|
||||||
|
|
||||||
\li Since Qt 5.14.0, as an app bundle (AAB), intended for distribution
|
\li Since Qt 5.14.0, as an app bundle (AAB), intended for distribution
|
||||||
in the Google Play store.
|
in the Google Play store.
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
|
\note Since \QC 4.12, Ministro is not supported.
|
||||||
|
|
||||||
To specify settings for application packages, select \uicontrol Projects >
|
To specify settings for application packages, select \uicontrol Projects >
|
||||||
\uicontrol {Build Android APK} > \uicontrol Details.
|
\uicontrol {Build Android APK} > \uicontrol Details.
|
||||||
|
|
||||||
@@ -67,23 +62,6 @@
|
|||||||
see \l {Specifying Run Settings for Android Devices}.
|
see \l {Specifying Run Settings for Android Devices}.
|
||||||
\endif
|
\endif
|
||||||
|
|
||||||
\section1 Using Ministro to Install Qt Libraries
|
|
||||||
|
|
||||||
To minimize the size of your APK, you can package the application with an
|
|
||||||
external dependency called Ministro. If a user downloads your application,
|
|
||||||
and it is the first application on their device to depend on Ministro, they
|
|
||||||
are asked to install Ministro before they can run your application.
|
|
||||||
|
|
||||||
Ministro serves as a central repository for Qt libraries. This enables
|
|
||||||
several applications to share the libraries, which only need to be installed
|
|
||||||
once. To use this deployment method, you must set up a repository for the
|
|
||||||
libraries that you want to distribute. To specify the
|
|
||||||
repository URL, edit the file \c {android/res/values/libs.xml}, which is
|
|
||||||
created by \QC.
|
|
||||||
|
|
||||||
To use Ministro to install the Qt libraries, select the
|
|
||||||
\uicontrol {Use Ministro service to install Qt} option.
|
|
||||||
|
|
||||||
\section1 Packaging Applications
|
\section1 Packaging Applications
|
||||||
|
|
||||||
Because bundling applications as APK packages is not
|
Because bundling applications as APK packages is not
|
||||||
@@ -126,8 +104,8 @@
|
|||||||
|
|
||||||
The packages are deployed on the connected Android devices. To switch the
|
The packages are deployed on the connected Android devices. To switch the
|
||||||
device used as a default device for the selected kit, select
|
device used as a default device for the selected kit, select
|
||||||
\uicontrol Projects > \uicontrol Run >
|
\uicontrol Projects > \uicontrol Run > \uicontrol {Deploy to Android device}
|
||||||
\uicontrol {Reset Default Devices}. The setting applies until you restart \QC.
|
> \uicontrol {Reset Default Devices}. The setting applies until you restart \QC.
|
||||||
For more information, see \l{Selecting Android Devices}.
|
For more information, see \l{Selecting Android Devices}.
|
||||||
|
|
||||||
For more information about the \c androiddeployqt tool, see
|
For more information about the \c androiddeployqt tool, see
|
||||||
@@ -137,7 +115,7 @@
|
|||||||
|
|
||||||
You can specify settings for the \c androiddeployqt tool in \QC and in the
|
You can specify settings for the \c androiddeployqt tool in \QC and in the
|
||||||
project .pro file. To specify settings in \QC, select \uicontrol Projects >
|
project .pro file. To specify settings in \QC, select \uicontrol Projects >
|
||||||
\uicontrol {Build Android APK} > \uicontrol Details.
|
\uicontrol Build > \uicontrol {Build Android APK} > \uicontrol Details.
|
||||||
|
|
||||||
\image qtcreator-android-deploy-configurations.png "Deploy configurations"
|
\image qtcreator-android-deploy-configurations.png "Deploy configurations"
|
||||||
|
|
||||||
@@ -150,6 +128,22 @@
|
|||||||
the \uicontrol {Compile Output} pane. To view additional information, select the
|
the \uicontrol {Compile Output} pane. To view additional information, select the
|
||||||
\uicontrol {Verbose output} check box.
|
\uicontrol {Verbose output} check box.
|
||||||
|
|
||||||
|
\section3 Selecting API Level
|
||||||
|
|
||||||
|
In the \uicontrol {Android build SDK} field, you can select the API level to use
|
||||||
|
for building the application. Usually, you should select the newest API
|
||||||
|
level available.
|
||||||
|
|
||||||
|
\note For Qt 5.12.0 to 5.12.5 and Qt 5.13.0 to 5.13.1, Android build SDK 28 should
|
||||||
|
be used. For recent versions than the latter, build SDK 29, or the most recent
|
||||||
|
should be used.
|
||||||
|
|
||||||
|
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{http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels}
|
||||||
|
{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
|
||||||
@@ -167,18 +161,6 @@
|
|||||||
|
|
||||||
\image qtcreator-android-build-steps.png "Android Build Steps"
|
\image qtcreator-android-build-steps.png "Android Build Steps"
|
||||||
|
|
||||||
\section3 Selecting API Level
|
|
||||||
|
|
||||||
In the \uicontrol {Android build SDK} field, you can select the API level to use
|
|
||||||
for building the application. Usually, you should select the newest API
|
|
||||||
level available.
|
|
||||||
|
|
||||||
This field does not specify the minimum supported API level nor the target
|
|
||||||
API level, which you can specify in the Android manifest file.
|
|
||||||
For more information about Android API levels, see
|
|
||||||
\l{http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels}
|
|
||||||
{What is API Level?}.
|
|
||||||
|
|
||||||
\section3 Signing Android Packages
|
\section3 Signing Android Packages
|
||||||
|
|
||||||
To publish your application, you must sign it by using a \e {public-private
|
To publish your application, you must sign it by using a \e {public-private
|
||||||
@@ -211,9 +193,9 @@
|
|||||||
|
|
||||||
\list 1
|
\list 1
|
||||||
|
|
||||||
\li In the \uicontrol Keystore field, select \uicontrol Create to create a new
|
\li In the \uicontrol Keystore field, select \uicontrol Create to create
|
||||||
keystore that contains one key pair in the \uicontrol {Create Keystore and
|
a new keystore that contains one key pair in the
|
||||||
a Certificate} dialog:
|
\uicontrol {Create a Keystore and a Certificate} dialog:
|
||||||
|
|
||||||
\image qtcreator-android-certificate.png
|
\image qtcreator-android-certificate.png
|
||||||
|
|
||||||
@@ -238,8 +220,8 @@
|
|||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
To sign an Android package by using a key pair, specify settings in the
|
To sign an Android package by using a key pair, set the \uicontrol {Sign package}
|
||||||
\uicontrol {Sign package} group:
|
group settings described in \l{Specifying Settings for Packages}:
|
||||||
|
|
||||||
\list 1
|
\list 1
|
||||||
|
|
||||||
@@ -258,21 +240,29 @@
|
|||||||
|
|
||||||
\QC automatically detects which Qt libraries the application uses and adds
|
\QC automatically detects which Qt libraries the application uses and adds
|
||||||
them as dependencies. If the application needs external libraries, specify
|
them as dependencies. If the application needs external libraries, specify
|
||||||
them in the \uicontrol {Additional Libraries} field. The libraries are copied into
|
them in \uicontrol Projects > \uicontrol Build > \uicontrol {Build Android APK}
|
||||||
|
> \uicontrol {Additional Libraries} field. The libraries are copied into
|
||||||
your application's library folder and loaded on startup.
|
your application's library folder and loaded on startup.
|
||||||
|
|
||||||
For example, to enable OpenSSL in your application, add the paths to the
|
To add OpenSSL libraries, select \uicontrol {Include prebuilt OpenSSL libraries}
|
||||||
required \c libssl.so and \c libcrypto.so libraries to the
|
in the \uicontrol {Additional Libraries} group. This will add the OpenSSL
|
||||||
\uicontrol {Additional Libraries} field.
|
include project defined in \l{Specifying Android Device Settings}{device settings}
|
||||||
|
in \uicontrol {Android OpenSSL} group. This can be used for QMake and CMake
|
||||||
|
projects.
|
||||||
|
|
||||||
\section3 Editing Manifest Files
|
Otherwise, you can manually add the paths to the required \c libssl.so and
|
||||||
|
\c libcrypto.so libraries to the \uicontrol {Additional Libraries} field.
|
||||||
|
|
||||||
|
\section1 Editing Manifest Files
|
||||||
|
|
||||||
You can use the qmake variables to specify all
|
You can use the qmake variables to specify all
|
||||||
the settings you need for the \c androiddeployqt tool and you do not need an
|
the settings you need for the \c androiddeployqt tool and you do not need an
|
||||||
Android manifest file until you want to publish the package in an
|
Android manifest file unless you need to specify Android specific settings
|
||||||
application store. To specify additional settings for APK packages, you can
|
like the application's icon. Also, the manifest file is needed if you want
|
||||||
create an Android manifest file and edit it in \QC. Select
|
to publish the package in the Play Store.
|
||||||
\uicontrol {Create Templates} to create the file and to open it in the
|
You can create an Android manifest file and edit it in \QC. Select
|
||||||
|
\uicontrol Projects > \uicontrol Build > \uicontrol {Build Android APK}
|
||||||
|
> \uicontrol {Create Templates} to create the file and to open it in the
|
||||||
Android Manifest Editor.
|
Android Manifest Editor.
|
||||||
|
|
||||||
\image qtcreator-android-manifest-editor.png "Android Manifest Editor"
|
\image qtcreator-android-manifest-editor.png "Android Manifest Editor"
|
||||||
@@ -292,9 +282,10 @@
|
|||||||
field, specify the version number that is shown to users.
|
field, specify the version number that is shown to users.
|
||||||
|
|
||||||
\li In the \uicontrol {Minimum required SDK} field, select the minimum API level
|
\li In the \uicontrol {Minimum required SDK} field, select the minimum API level
|
||||||
required to run the application. The minimum supported API level is
|
required to run the application. The minimum supported API level for \QC is
|
||||||
android-9. \QC does not allow you to select an API
|
android-9. However, Qt versions might have different minimum API levels, and
|
||||||
level that the Qt version specified for the kit does not support.
|
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
|
\li In the \uicontrol {Target SDK} field, select the targeted API level of the
|
||||||
application. This affects the activation of some compatibility features in
|
application. This affects the activation of some compatibility features in
|
||||||
@@ -302,42 +293,49 @@
|
|||||||
means that the overflow button in the system navigation bar will not be
|
means that the overflow button in the system navigation bar will not be
|
||||||
enabled by default.
|
enabled by default.
|
||||||
|
|
||||||
\li In the \uicontrol Application group, you can give the application a name and
|
\li In the \uicontrol Application group, you can set the application's name.
|
||||||
select an icon for it. The three icon fields can contain different versions
|
You can also give an activity a name and select the activity to run.
|
||||||
of the icon with low, medium, and high DPI values, from left to right.
|
|
||||||
You can also give an activity a name and select the activity to run.
|
\li The \uicontrol {Style extraction} combo box sets the used method that Qt
|
||||||
|
uses to extract style information. It has the following values:
|
||||||
|
\list
|
||||||
|
\li \uicontrol Default or \uicontrol Full: Use this when working with
|
||||||
|
Qt Widgets or Qt Quick Controls 1.
|
||||||
|
|
||||||
|
\note This method uses some Android non-SDK interfaces,
|
||||||
|
that are being restricted by Google starting from Android 9.0
|
||||||
|
(API 28).
|
||||||
|
\li \uicontrol minimal: Use this when working with Qt Quick Controls 2
|
||||||
|
with no Qt Widgets or Qt Quick Controls 1. This is faster than
|
||||||
|
\uicontrol full or \uicontrol default.
|
||||||
|
\li \uicontrol none: Use this if you're not working with Qt Widgets,
|
||||||
|
or Qt Quick Controls 1 or 2 in your project.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
\li In \uicontrol {Application icon}, select an icon. Click the
|
||||||
|
\uicontrol {Master icon} button to select an icon with the highest resolution,
|
||||||
|
then, it will resize and set the three icon fields for low, medium, and high DPI icons
|
||||||
|
as needed.
|
||||||
|
|
||||||
\li In the \uicontrol Permissions field, you can specify the permissions that your
|
\li In the \uicontrol Permissions field, you can specify the permissions that your
|
||||||
application needs. Users are asked to grant the permissions when they
|
application needs. Starting from Android 6.0 (API 23), permissions have to be
|
||||||
install the application. Android OS then grants the application access to
|
requested at runtime (See \l{QtAndroidExtras}{requestPermissionsSync} or
|
||||||
the appropriate data and features.
|
\l{QtAndroidExtras}{requestPermissions}). 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 appropriate data and features.
|
||||||
|
|
||||||
\li Select the \uicontrol {Include default permissions for Qt modules} and
|
\li 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.
|
permissions needed by Qt libraries. This can be
|
||||||
|
android.permission.WRITE_EXTERNAL_STORAGE for QtCore, or
|
||||||
|
android.permission.ACCESS_COARSE_LOCATION for QtLocation.
|
||||||
|
|
||||||
\li To add permissions, select them in the list, and then select \uicontrol Add.
|
\li To add a permission, select it from the list, and then click \uicontrol Add.
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
Select the \uicontrol {XML Source} tab to edit the file in XML format.
|
On the top header, select the \uicontrol {XML Source} tab to edit the file
|
||||||
|
in XML format.
|
||||||
\section1 Installing Ministro
|
|
||||||
|
|
||||||
The easiest way to install Ministro is to do it on the device via Google
|
|
||||||
Play. When you run the application for the first time, a dialog pops up and
|
|
||||||
guides you through the installation.
|
|
||||||
|
|
||||||
To use \QC to install Ministro, you must first download the Ministro .apk
|
|
||||||
from the Google Market or from the
|
|
||||||
\l{http://necessitas.kde.org/necessitas/ministro.php}{Ministro} home page.
|
|
||||||
|
|
||||||
Then select \uicontrol Projects > \uicontrol Run > \uicontrol {Install Ministro from APK}.
|
|
||||||
|
|
||||||
You can use this option also to install any Android package (.apk).
|
|
||||||
|
|
||||||
You can use this option to install applications on an Android Virtual
|
|
||||||
Device (AVD).
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -184,9 +184,12 @@
|
|||||||
support for \l{http://doc.qt.io/qt-5/qtvirtualkeyboard-index.html}
|
support for \l{http://doc.qt.io/qt-5/qtvirtualkeyboard-index.html}
|
||||||
{Qt Virtual Keyboard} to the application.
|
{Qt Virtual Keyboard} to the application.
|
||||||
|
|
||||||
|
\note \l{http://doc.qt.io/qt-5/qtvirtualkeyboard-index.html}
|
||||||
|
{Qt Virtual Keyboard} is not supported for Android and iOS.
|
||||||
|
|
||||||
\li Select \l{glossary-buildandrun-kit}{kits} for the platforms that
|
\li Select \l{glossary-buildandrun-kit}{kits} for the platforms that
|
||||||
you want to build the application for. To build applications for
|
you want to build the application for. To build applications for
|
||||||
mobile devices, select kits for Android ARM and iPhone OS, and
|
mobile devices, select kits for Android ARM and iOS, and
|
||||||
click \uicontrol{Next}.
|
click \uicontrol{Next}.
|
||||||
|
|
||||||
\note Kits are listed if they have been specified in \uicontrol
|
\note Kits are listed if they have been specified in \uicontrol
|
||||||
|