2016-01-15 14:51:16 +01:00
|
|
|
/****************************************************************************
|
2012-07-24 15:31:23 +02:00
|
|
|
**
|
2019-10-31 14:16:27 +01:00
|
|
|
** Copyright (C) 2019 The Qt Company Ltd.
|
2016-01-15 14:51:16 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-07-24 15:31:23 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** This file is part of the Qt Creator documentation.
|
2012-07-24 15:31:23 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-07-24 15:31:23 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** GNU Free Documentation License Usage
|
2012-07-24 15:31:23 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
|
|
|
** Documentation License version 1.3 as published by the Free Software
|
2016-01-15 14:51:16 +01:00
|
|
|
** Foundation and appearing in the file included in the packaging of
|
|
|
|
|
** this file. Please review the following information to ensure
|
|
|
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
|
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
2012-07-24 15:31:23 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
****************************************************************************/
|
2012-07-24 15:31:23 +02:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\page creator-developing-android.html
|
2018-08-10 16:15:05 +02:00
|
|
|
\previouspage creator-connecting-mobile.html
|
|
|
|
|
\if defined(qtdesignstudio)
|
|
|
|
|
\nextpage creator-developing-generic-linux.html
|
|
|
|
|
\else
|
2013-10-07 10:29:39 +02:00
|
|
|
\nextpage creator-developing-baremetal.html
|
2018-08-10 16:15:05 +02:00
|
|
|
\endif
|
2012-07-24 15:31:23 +02:00
|
|
|
|
|
|
|
|
\title Connecting Android Devices
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
You can connect Android devices to the development PC to build, run, debug,
|
|
|
|
|
and analyze applications from \QC. Devices with Android
|
2018-10-11 11:49:26 +02:00
|
|
|
version 4.1 (API level 16) or later are supported.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
|
|
|
|
If you have a tool chain for building applications for Android devices
|
2012-09-03 17:50:37 +02:00
|
|
|
installed on the development PC, you can add it to \QC. You can then add a
|
|
|
|
|
\l{glossary-buildandrun-kit}{kit}
|
2020-03-12 16:45:39 +02:00
|
|
|
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. Starting from Qt 5.14.0,
|
|
|
|
|
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.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2013-02-15 15:10:45 +01:00
|
|
|
The Android Debug Bridge (adb) command line tool is integrated to \QC to
|
|
|
|
|
enable you to deploy applications to connected Android devices, to run
|
2020-03-12 16:45:39 +02:00
|
|
|
them, and to read their logs. It includes a client and server that run on
|
|
|
|
|
the development host and a daemon that runs on the emulator or device.
|
2013-02-15 15:10:45 +01:00
|
|
|
|
2012-07-24 15:31:23 +02:00
|
|
|
\section1 Requirements
|
|
|
|
|
|
|
|
|
|
To use \QC to develop Qt applications for Android, you need the following:
|
|
|
|
|
|
|
|
|
|
\list
|
2020-06-26 14:37:48 +03:00
|
|
|
\li \l{AdoptOpenJDK} for all platforms. You can also use \l{OpenJDK}
|
|
|
|
|
on Linux.
|
2018-10-11 11:49:26 +02:00
|
|
|
|
2020-06-26 14:37:48 +03:00
|
|
|
\note Android SDK Tools versions <= 26.x have issues with JDK versions
|
|
|
|
|
later than 8. It is recommended to use the latest Command-line SDK Tools.
|
2013-10-31 14:35:05 +01:00
|
|
|
|
2017-08-08 09:49:17 +02:00
|
|
|
\li \l{http://www.gradle.org}{Gradle} for building application packages
|
2019-10-31 14:16:27 +01:00
|
|
|
(APK) and app bundles (AAB) for Android devices. Gradle is delivered
|
2020-03-12 16:45:39 +02:00
|
|
|
with Qt 5.9, and later, because Gradle scripts are not delivered
|
|
|
|
|
with Android SDK tools since version 26.0.0.
|
2014-09-22 12:34:28 +02:00
|
|
|
|
2017-10-13 11:40:50 +02:00
|
|
|
\note Using Ant to build APKs is no longer supported.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2017-05-11 16:26:02 +02:00
|
|
|
\li \l{http://developer.android.com/sdk/index.html}{Android SDK Tools}
|
|
|
|
|
|
2017-09-04 13:50:33 +02:00
|
|
|
The following Android SDK packages and tools are required for
|
|
|
|
|
development:
|
|
|
|
|
|
|
|
|
|
\list
|
|
|
|
|
\li Platform tools
|
|
|
|
|
\li Build tools
|
|
|
|
|
\li At least one SDK platform
|
2020-03-12 16:45:39 +02:00
|
|
|
\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}.
|
2017-09-04 13:50:33 +02:00
|
|
|
\endlist
|
2015-07-28 17:01:38 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\li On Windows, you also need the Android Debug Bridge (ADB) driver
|
|
|
|
|
on the Windows platform to enable USB debugging. The default USB
|
|
|
|
|
driver on Windows does not allow debugging. For more information
|
|
|
|
|
about installing ADB, see \l {ADB windows driver}
|
|
|
|
|
{ADB driver installation}.
|
|
|
|
|
\endlist
|
2013-11-15 15:54:25 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\section1 Setting Up the Development Environment
|
2013-11-15 15:54:25 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
To build Android applications with Qt, install Qt for Android 5.2, or later.
|
2013-11-15 15:54:25 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\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).
|
2013-11-15 15:54:25 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
For more information, see \l{Qt for Android}.
|
2018-11-23 14:11:28 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
Download and install the latest Android SDK, and then install
|
|
|
|
|
or update the NDKs, tools and packages needed for development.
|
2013-11-15 15:54:25 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
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}.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
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.
|
2018-10-11 11:49:26 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\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.
|
2017-09-04 13:50:33 +02:00
|
|
|
|
|
|
|
|
\list
|
2020-03-12 16:45:39 +02:00
|
|
|
\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.
|
2017-09-04 13:50:33 +02:00
|
|
|
|
|
|
|
|
\li Android SDK Tools version 25.2.5, or earlier
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
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:
|
|
|
|
|
|
2017-09-04 13:50:33 +02:00
|
|
|
Use the
|
|
|
|
|
\l{https://developer.android.com/studio/tools/help/android.html}
|
|
|
|
|
{android} tool that comes with the SDK Tools package. For example,
|
|
|
|
|
on Ubuntu the following command starts the SDK update:
|
|
|
|
|
|
|
|
|
|
\code
|
|
|
|
|
./android update sdk
|
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
|
|
\endlist
|
2017-08-08 09:49:17 +02:00
|
|
|
|
2017-10-17 12:58:22 +02:00
|
|
|
\section2 Specifying Android Device Settings
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
To configure connections to Android devices and general Android settings:
|
2012-07-24 15:31:23 +02:00
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
|
2016-10-04 16:58:17 +02:00
|
|
|
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices >
|
2017-10-17 12:58:22 +02:00
|
|
|
\uicontrol Android.
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\image qtcreator-options-android-main.png "Android options"
|
2017-10-17 12:58:22 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\li In the \uicontrol {JDK location} field, set the path to the JDK.
|
2017-10-17 12:58:22 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
By default, \QC tries to find any valid JDK/OpenJDK installation.
|
|
|
|
|
However, if none is found, you must set it manually. Click the
|
|
|
|
|
\inlineimage icons/download-icon.png
|
|
|
|
|
(\uicontrol Download) button to open the JDK download web page in the
|
|
|
|
|
default browser. \QC checks the JDK installation and reports errors.
|
2017-10-17 12:58:22 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\li In the \uicontrol {Android Settings} group, set the path to the
|
|
|
|
|
Android SDK Tools.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
Select \inlineimage reload_gray.png
|
|
|
|
|
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.
|
2014-03-25 15:39:43 +01:00
|
|
|
|
2017-10-17 12:58:22 +02:00
|
|
|
The SDK Manager checks the Android NDK and SDK installations,
|
|
|
|
|
reports errors, and offers to install the necessary packages.
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\image qtcreator-options-android-sdk-tools.png "Android NDK and SDK checks"
|
2017-10-17 12:58:22 +02:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\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.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Select the \uicontrol {Automatically create kits for Android tool chains}
|
2013-03-04 13:21:27 +01:00
|
|
|
check box to allow \QC to create the kits for you. \QC displays a
|
|
|
|
|
warning if it cannot find a suitable Qt version.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2020-04-03 16:28:42 +02:00
|
|
|
\li Select \uicontrol File > \uicontrol {New File or Project} >
|
|
|
|
|
\uicontrol {Application (Qt Quick)} >
|
|
|
|
|
\uicontrol {Qt Quick Application - Empty} > \uicontrol Choose, and
|
2019-10-31 14:16:27 +01:00
|
|
|
follow the instructions of the wizard to create a project. For more
|
|
|
|
|
information, see
|
2018-08-30 12:36:23 +02:00
|
|
|
\if defined(qtcreator)
|
2013-05-03 16:57:37 +02:00
|
|
|
\l{Creating Qt Quick Projects}.
|
2018-08-30 12:36:23 +02:00
|
|
|
\else
|
|
|
|
|
\l{Creating UI Prototype Projects}.
|
|
|
|
|
\endif
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To specify settings for deploying applications to Android, select
|
2014-12-11 15:43:19 +01:00
|
|
|
\uicontrol Projects > \uicontrol Run for the \uicontrol Android kit, and then select
|
|
|
|
|
\uicontrol Details to view the \uicontrol {Deploy configurations}. For more
|
2012-07-24 15:31:23 +02:00
|
|
|
information about the options you have, see
|
|
|
|
|
\l{Deploying Applications to Android Devices}.
|
|
|
|
|
|
2014-01-17 10:19:58 +01:00
|
|
|
\li Enable debugging on your Android device.
|
2012-07-24 15:31:23 +02:00
|
|
|
|
2014-01-17 10:19:58 +01:00
|
|
|
Debugging is enabled in different ways on different Android devices.
|
2014-12-11 15:43:19 +01:00
|
|
|
Look for \uicontrol {USB Debugging} under \uicontrol {Developer Options}. On
|
|
|
|
|
some devices \uicontrol {Developer Options} is hidden and becomes visible
|
2020-03-12 16:45:39 +02:00
|
|
|
only when you tap the \uicontrol {Build number} field in \uicontrol Settings >
|
|
|
|
|
\uicontrol About several times. For more details, check
|
|
|
|
|
\l{https://developer.android.com/studio/debug/dev-options}{Configure on-device developer options}.
|
2013-05-03 16:57:37 +02:00
|
|
|
|
2014-01-17 10:19:58 +01:00
|
|
|
\li Connect the Android device to the development PC with a USB cable.
|
|
|
|
|
You might be asked to select a device in the
|
2020-03-12 16:45:39 +02:00
|
|
|
\l{Selecting Android Devices}{Select Android Devices} dialog.
|
2014-01-17 10:19:58 +01:00
|
|
|
\endlist
|
2013-05-03 16:57:37 +02:00
|
|
|
|
2017-10-17 12:58:22 +02:00
|
|
|
\section2 Managing Android SDK Packages
|
|
|
|
|
|
|
|
|
|
Since Android SDK Tools version 25.3.0, only a command-line tool,
|
|
|
|
|
\l{https://developer.android.com/studio/command-line/sdkmanager.html}
|
|
|
|
|
{sdkmanager}, is provided by Android for SDK package management. To make SDK
|
|
|
|
|
management easier, \QC provides an SDK Manager for installing, updating, and
|
|
|
|
|
removing SDK packages. You can still use sdkmanager for advanced SDK
|
|
|
|
|
management.
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
After you set the path to the Anroid SDK in \uicontrol Tools >
|
|
|
|
|
\uicontrol Options > \uicontrol Devices > \uicontrol Android, the
|
2017-10-17 12:58:22 +02:00
|
|
|
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
|
2020-03-12 16:45:39 +02:00
|
|
|
add or remove those packages. Before taking action, it prompts
|
|
|
|
|
you to accept the changes it is about to make. In addition, it prompts you to
|
2017-10-17 12:58:22 +02:00
|
|
|
accept Google licenses, as necessary.
|
|
|
|
|
|
|
|
|
|
To view the installed Android SDK packages, select \uicontrol Tools >
|
|
|
|
|
\uicontrol Options > \uicontrol Devices > \uicontrol Android >
|
|
|
|
|
\uicontrol {SDK Manager}.
|
|
|
|
|
|
|
|
|
|
\image qtcreator-android-sdk-manager.png "Android SDK Manager"
|
|
|
|
|
|
|
|
|
|
To filter the packages, select \uicontrol Available, \uicontrol Installed,
|
|
|
|
|
or \uicontrol All in \uicontrol {Show Packages}.
|
|
|
|
|
|
|
|
|
|
To update the installed Android SDK packages, select
|
|
|
|
|
\uicontrol {Update Installed}. Select the packages to update, and then
|
|
|
|
|
select \uicontrol Apply.
|
|
|
|
|
|
|
|
|
|
To specify advanced sdkmanager settings, select
|
|
|
|
|
\uicontrol {Advanced Options} and enter arguments in the
|
|
|
|
|
\uicontrol {SDK Manager arguments} field. The available arguments are listed
|
|
|
|
|
and described in \uicontrol {Available arguments}.
|
|
|
|
|
|
|
|
|
|
To manage packages installed from Android SDK Tools version 25.2.5, or
|
|
|
|
|
earlier, you can use the native Android SDK Manager. The \QC SDK Manager and
|
|
|
|
|
the native SDK Manager are mutually exclusive, because they are used for
|
|
|
|
|
different Android SDK Tools versions. If you have the native SDK Manager
|
|
|
|
|
installed, you can open it by selecting \uicontrol {Native SDK Manager}.
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
\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"
|
|
|
|
|
|
2013-10-31 14:35:05 +01:00
|
|
|
\section1 Selecting Android Devices
|
|
|
|
|
|
|
|
|
|
When you deploy an application to an Android device with Android
|
2020-03-12 16:45:39 +02:00
|
|
|
version 4.2 (API 16) or later, the \uicontrol {Select Android Device} dialog
|
|
|
|
|
opens. It lists the devices that are connected to the development PC, as
|
|
|
|
|
well as AVDs, and their status. You can select devices or AVDs from the
|
|
|
|
|
\uicontrol {Compatible Devices} list for deployment.
|
2013-10-31 14:35:05 +01:00
|
|
|
|
|
|
|
|
If \QC determines that a device is not ready for deployment, it places the
|
2014-12-11 15:43:19 +01:00
|
|
|
device in the \uicontrol {Incompatible Devices} list, with information about the
|
2013-10-31 14:35:05 +01:00
|
|
|
issue. For example, you might need to authorize the connection on the
|
|
|
|
|
device. After you authorize the connection on the device, select
|
2014-12-11 15:43:19 +01:00
|
|
|
\uicontrol {Refresh Device List}. The device is moved to the
|
|
|
|
|
\uicontrol {Compatible Devices} list and you can select it for deployment.
|
2013-10-31 14:35:05 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
Other reasons for showing a device in \uicontrol {Incompatible Devices} are
|
2013-10-31 14:35:05 +01:00
|
|
|
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
|
|
|
|
|
(for example, you cannot deploy an ARM build on an x86 device).
|
|
|
|
|
|
|
|
|
|
\image qtcreator-android-select-devices.png "Select Android Devices dialog"
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
To \l{Creating a New AVD}{create a new AVD}, select \uicontrol {Create Android Virtual Device}.
|
2013-10-31 14:35:05 +01:00
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
To set a device as the default device for a particular Android architecture
|
|
|
|
|
for the current project, select the \uicontrol {Always use this device for architecture}
|
|
|
|
|
check box. The \uicontrol {Select Android Devices} dialog will not appear
|
|
|
|
|
until you switch to another project or restart \QC.
|
2013-10-31 14:35:05 +01:00
|
|
|
|
2013-05-03 16:57:37 +02:00
|
|
|
\section1 Using the Android Emulator
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
To run your application on the Android Emulator, you must have an Android
|
|
|
|
|
virtual device (AVD). For more information about creating a new one, see
|
|
|
|
|
\l{Creating a New AVD}. If you run an application without a device connected to the
|
2013-05-03 16:57:37 +02:00
|
|
|
development PC and without an AVD specified, \QC asks you to add an AVD.
|
|
|
|
|
|
2020-03-12 16:45:39 +02:00
|
|
|
For Android SDK Tools 25.2.5, or earlier, select \uicontrol {Native AVD Manager}
|
|
|
|
|
to manage AVDs.
|
2013-05-03 16:57:37 +02:00
|
|
|
|
|
|
|
|
\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
|
2020-03-12 16:45:39 +02:00
|
|
|
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}.
|
2013-05-03 16:57:37 +02:00
|
|
|
|
2012-07-24 15:31:23 +02:00
|
|
|
\section1 Debugging on Android Devices
|
|
|
|
|
|
2018-10-11 11:49:26 +02:00
|
|
|
Select a \l{glossary-build-config}{debug build configuration} to build
|
2012-07-24 15:31:23 +02:00
|
|
|
the application for debugging.
|
|
|
|
|
|
2018-07-19 12:52:21 +02:00
|
|
|
\note \QC cannot debug applications on Android devices if Android Studio is
|
|
|
|
|
running. If the following message is displayed in the \uicontrol Output
|
2020-03-12 16:45:39 +02:00
|
|
|
pane, close Android Studio and try again:
|
|
|
|
|
|
|
|
|
|
\badcode
|
|
|
|
|
Ignoring second debugger -accepting and dropping.
|
|
|
|
|
\endcode
|
2018-07-19 12:52:21 +02:00
|
|
|
*/
|