Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
androiddeployqt.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page android-deploy-qt-tool.html
6
\brief An overview of the androiddeployqt tool and how to use it.
7
\title The androiddeployqt Tool
8
9
\target androiddeployqt
10
Building an Android package involves many steps, so Qt comes with a tool which
11
handles the work for you. The steps handled by the androiddeployqt
12
tool are described in \l{Deploying an Application on Android}.
13
14
\section1 Prerequisites Before Running androiddeployqt
15
16
Before running the tool manually, you need to configure your project with
17
\c CMake or \c qmake to generate \c Makefiles and a \c JSON file (i.e.
18
\c{android-<target_name>-deployment-settings.json}) containing important settings
19
used by \c androiddeployqt.
20
21
\note It is not recommended to modify the androiddeployqt JSON file.
22
23
To prepare the environment for androiddeployqt, configure your project in
24
a separate directory than your source directory. For more information on
25
configuring your project, see \l {Building \Q4A Projects from Command Line}.
26
27
\section1 Command Line Arguments
28
29
The only required command line arguments when running the tool are
30
\c {--input} and \c {--output}. Other command line arguments are optional but
31
useful. The list below is available by passing the \c {--help} argument to
32
androiddeployqt.
33
34
\quotefromfile main.cpp
35
\skipto Syntax: androiddeployqt --output <destination> [options]
36
\printuntil --help: Displays this information.
37
38
With a \c project_name, to build the application package with \c androiddeployqt
39
without deploying it the device, run the following:
40
41
\badcode
42
androiddeployqt --input <build_dir>/android-project_name-deployment-settings.json \
43
--output <build_dir>/android-build
44
\endcode
45
46
To build and deploy the package to the device:
47
48
\badcode
49
androiddeployqt --input <build_dir>/android-project_name-deployment-settings.json \
50
--output <build_dir>/android-build --install --device <device_serial_id>
51
\endcode
52
53
\section1 Dependencies Detection
54
55
Qt comes with a number of plugins which are loaded at run-time when they are
56
needed. These can handle anything from connecting to SQL databases to loading
57
specific image formats. Detecting plugin dependencies is impossible as the
58
plugins are loaded at run-time, but androiddeployqt tries to guess such
59
dependencies based on the Qt dependencies of your application. If the plugin
60
has any Qt dependencies which are not also dependencies of your application,
61
it will not be included by default. For instance, in order to ensure that
62
the SVG image format plugin is included, you will need to add \l {Qt SVG}
63
module to your project for it to become a dependency of your application:
64
65
\badcode
66
find_package(Qt6 REQUIRED COMPONENTS Svg)
67
...
68
target_link_libraries(target_name PRIVATE Qt6::Svg)
69
\endcode
70
71
If you are wondering why a particular plugin is not included automatically,
72
you can run androiddeployqt with the \c{--verbose} option to get the list of
73
missing dependencies for each excluded plugin. You can achieve the same in
74
\QC by ticking the \uicontrol {Verbose output} check box in the
75
\uicontrol {Projects} > \uicontrol {Build Steps} > \uicontrol {Build Android APK} >
76
\uicontrol {Advanced Actions}.
77
78
It's also possible to manually specify the dependencies of your application.
79
For more information, see \l {QT_ANDROID_DEPLOYMENT_DEPENDENCIES} CMake variable.
80
81
\note androiddeployqt scans the QML files of the project to collect the QML imports.
82
However, if you are loading QML code as a QString from C++ at runtime, that might
83
not work properly because androiddeployqt won't be aware of it at deploy time.
84
To remedy that, you can add a dummy QML file that imports such QML modules that
85
are referenced at runtime.
86
87
\section1 Deployment in \QC
88
89
\QC uses \c androiddeployqt under the hood, and provides easy
90
and intuitive user interfaces to specify various options. For more information,
91
see \l{\QC: Android Deploy Configuration}.
92
93
For more information about customizing and deploying a \Q4A app,
94
see \l {Deploying an Application on Android}.
95
*/
qtbase
src
tools
androiddeployqt
doc
src
androiddeployqt.qdoc
Generated on
for Qt by
1.14.0