summaryrefslogtreecommitdiffstats
path: root/doc/src/platforms/android/android.qdoc
blob: c803b5db6e580b041d5398a6b94d5c98a5801127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page android.html
    \title Qt for Android
    \brief Provides information about Android support in Qt.
    \ingroup supportedplatform
    \nextpage android-getting-started.html

    Qt for \tm Android enables you to develop Qt applications for Android devices,
    and supports a wide range of features and use-cases.

    To start your Qt for Android application, download and install Qt for Android
    and use the \QC IDE, follow the instructions on the
    \l{Getting Started with Qt for Android} page.

    If you have an existing Android application, try \l{Qt Quick for Android}. It includes
    \l{\QtTAS}{plugin} for Google's Android Studio. Find it on the IntelliJ marketplace.
    This enables you to add Qt Quick content to your Android app as a \l {Android: View}{View}.

     To build Qt from source, see
     \l{Qt for Android - Building from Source}{Building from Source}.

    \target android-supported-configurations
    \section1 Supported Configurations

    \include supported-platforms.qdocinc android

    \section1 Explore Qt for Android

    To learn about developing with Qt for Android, here are the main topics
    to check:

    \list
        \li \l {Getting Started with Qt for Android}
        \li \l {Deploying an Application on Android}
        \li \l {How Qt for Android Works}
        \li \l {Qt for Android - Building from Source}{Building Qt for Android from Source}
        \li \l {Building Qt for Android Projects from Command Line}
        \li \l {The androiddeployqt Tool}
        \li \l {Qt for Android Manifest File Configuration}
        \li \l{Qt Jenny: Java Code Generator}
    \endlist

    The following topics also provide more details about Qt for Android:

    \annotatedlist android-platform-extra-topics

    \section1 Android Fragments

    You cannot use \l{Android: Fragments}{Android Fragments} in a Qt for Android application.

    However, Qt does offer its own modular components and views with QML. You can combine
    multiple components in one QML view. For more information, see \l{Qt Qml}.

    If you are integrating \l{Qt Quick for Android} into an Android application, the
    \l QtQuickView API can be used inside fragments.


    Qt's vibrant and active \l{https://www.qt.io/developers}{community site}
    houses a wiki, a forum, and additional learning guides and presentations.

    For information about licensing, check \l {Android GNU C++ Run-time Licensing}.

    \section1 Where to Go from Here

    We invite you to explore the rest of Qt. We prepared overviews which help
    you decide which APIs to use and our examples demonstrate how to use our
    APIs.

    \list
        \li \l{Qt Overviews} - list of topics about application development
        \li \l{Qt Examples and Tutorials}{Examples and Tutorials} - code samples and tutorials
        \li \l{Qt Reference Pages} - a listing of C++ and QML APIs
        \li \l{\QC: Tutorial: Mobile application}
        \li \l{\QC: Set up Android development environment}
    \endlist
*/

/*!
    \page android-getting-started.html
    \title Getting Started with Qt for Android
    \brief Provides instructions to install and configure your development environment.
    \previouspage android.html
    \nextpage android-how-it-works.html

    The video below is a beginner's guide to using the Qt for Android toolchain,
    including the \QC IDE, to get you started developing Qt for Android apps.

    \youtube 5OiIqFTjUZI

    To learn the basics of getting started with Qt for Android, take the
    \l {https://www.qt.io/academy/course-catalog#getting-started-with-qt-for-android-}
    {Getting Started with Qt for Android} course in Qt Academy.

    The rest of this page has more detailed getting started information.

    To download and install Qt for Android, follow the instructions on the
    \l{Getting Started with Qt} page.

    \section1 Android Development Prerequisites

    In order to develop with \l{Qt for Android}, you will need the following
    prerequisites:

    \list
        \li \l {Java Development Kit (JDK)}
        \li \l {Android: Android command line tools}{Android Command Line Tools}
            which includes:
            \list
                \li \l{Android: The Android NDK}{Android NDK}: for building C++ code.
                \li \l{Android: Android SDK Platforms}{Android SDK Platform} and
                    \l{Android: Android SDK Build Tools}{Android SDK Build Tools}: for building
                    Android apps for specific API versions.
                \li \l{Android: Android SDK Platform Tools}{Android SDK Platform Tools}:
                    for deploying and managing Android dependencies.
            \endlist
    \endlist

    The easiest way to manage the dependencies is by using \QC's built-in
    Android development setup. When you first open \QC after installing Qt for
    Android, you are asked if you want to run the Android setup wizard. This also
    sets up OpenSSL for Android.

    \section2 Using an existing SDK location

    If you already have an Android SDK setup, you don't need to run this wizard. Instead, in
    \QC go to \uicontrol{Preferences > Devices > Android} and browse to your existing JDK
    and SDK paths. See common \l{Android SDK paths}. For more information, see
    \l{\QC: Set up Android development environment}.

    \section2 Manually Installing the Prerequisites

    If you prefer to manually install the prerequisites please follow
    these next steps.

    \section3 Java Development Kit (JDK)

    Qt for Android development requires JDK \JdkVer or above, provided by any of the
    following supported distributions:

    \list
        \li \l{Adoptium}
        \li \l{OpenJDK}
        \li \l{Java SE Development Kit}
    \endlist

    Install your preferred JDK. If your installer doesn't set the
    \c JAVA_HOME environment variable that points to the location of
    the installed JDK, you can set it manually. For example on Linux:

    \badcode \JdkVer
    sudo apt-get install openjdk-\1-jdk
    export JAVA_HOME=/usr/lib/jvm/java-\1-openjdk-amd64
    \endcode

    Or on \macOS:

    \badcode \JdkVer
    brew install openjdk@\1
    sudo ln -sfn "$(brew --prefix openjdk@\1)/libexec/openjdk.jdk" \
        "/Library/Java/JavaVirtualMachines/openjdk-\1.jdk"
    export JAVA_HOME="$(/usr/libexec/java_home -v \1)"
    \endcode

    \section3 Android SDK Command Line Tools

    Download the latest version of the
    \l{Android: Android command line tools}{Android SDK Command Line Tools}
    for your operating system and extract it to the appropriate path as stated below.

    \section4 Android SDK paths

//! [Android SDK Paths]
    The Android SDK is commonly installed by \QC or Android Studio
    in the following locations:
    \list
        \li Linux: ~/Android/Sdk/
        \li \macos: ~/Library/Android/sdk/
        \li Windows: C:\\Users\\<USER>\\AppData\\Local\\Android\\Sdk\\
    \endlist
//! [Android SDK Paths]

    Or use your OS's package manager, for example for \macOS:

    \badcode
    brew install android-commandlinetools
    \endcode

    \section3 Android SDK Mandatory Packages

    Make sure to install the SDK Platform, Platform Tools, and Build Tools.
    For Qt \QtVer, use:

    \badcode \AndroidPlatformVer \AndroidBuildToolsVer
    sdkmanager "platform-tools" "platforms;android-\1" "build-tools;\2"
    \endcode

    \section3 Android NDK

    Qt \QtVer uses NDK \NdkFullVer, you can install it by running:

    \badcode \NdkFullVer
    sdkmanager "ndk;\1"
    \endcode

    For example for \macOS:

    \section3 Emulator

    If you wish to use the \l{Android: Android Emulator}{Android Emulator},
    you can install it by running:

    \badcode
    sdkmanager "emulator"
    \endcode

    \section3 Platform Specific Configurations

    \section4 Windows

    The default USB driver on Windows does not allow debugging using
    Android Debug Bridge (ADB) tool. You must install the additional USB driver
    provided by the \e extras Android SDK package. Install it by running the following:

    \badcode
    sdkmanager.bat "extras;google;usb_driver"
    \endcode

    \section4 Linux

    The following dependencies are needed for using tools such as \c adb or \c gdb which
    can be used by \QC:

    \badcode
    sudo apt-get install libstdc++6 libncurses5
    \endcode

    \target emulator dependencies
    To run the Android emulator, the following dependencies are also necessary:

    \section3 Testing the Setup

    Now you can test your development setup by running the examples shipped with the
    Qt installation. For more information, see
    \l{Qt Examples And Tutorials#Mobile}{Mobile Examples}.

    To develop a simple application from scratch, see
    \l {\QC: Tutorial: Mobile application}.
*/

/*!
    \page android-supported-versions-selection-guidelines.html
    \title Qt for Android Supported Versions Selection Guidelines
    \brief Provides information about supported Android versions under a Qt release.

    To keep the supported versions to a level that’s maintainable
    by Qt, especially for LTS releases which are expected to live for a period of
    3 years, Qt for Android has guidelines for selecting the supported
    versions for a given Qt release. This makes the selection clear and
    transparent, and help shape proper expectations of support for each Qt for
    Android release.

    \section1 Minimum Supported Version

    The guidelines for selecting the minimum supported version are:

    \list
        \li Evaluate the minimum version once a year for the fall release of Qt,
            which would also cover LTS releases.
        \li Target at least 90% of the cumulative usage in the market as listed
            on \l {https://apilevels.com}{apilevels.com} at the time of the
            platform freeze deadline of a given fall release.
        \li The selection is done 1 month before the platform freeze, at which
            time we check what versions would fit the 90% range, and decide
            whether to select a more recent minimum version or not and to what
            new minimum version.
        \li The changes are communicated to the Qt development mailing list,
            and reflected in the release change log and Qt for Android documentation.
        \li In exceptional cases where a change is needed to a version that doesn’t
            respect the criteria above, it will be announced at the time of the
            platform freeze deadline along with reasons for the decision.
    \endlist

    The minimum version changes will be reflected in our CI test runs, and in
    the build system (i.e. CMake and androiddeployqt), thus the released libraries
    would require said minimum version to run. To target older versions a Qt
    rebuild with appropriate build system changes would be needed. Even if such
    builds might work for older versions, note that they would fall outside
    of Qt official support scope. Although, the official Qt for Android libraries
    might or might not work for builds targeting older versions than the minimum
    for the release.

    \section1 Maximum Supported Version

    In a spring Qt release, we aim to support an Android version which was
    released by Google in the fall of the year before. This becomes the new
    maximum supported version by Qt.

    Qt LTS releases would also support new Android versions coming out to market
    for up to two years after the initial Qt LTS patch release. This allows users
    to target newer Android versions to comply with Google Play Store target
    SDK publishing policies. In effect, new Android versions released in this
    two year period will become the maximum versions supported for the LTS
    release in the following patch release of the Qt LTS version.

    \section1 Target Devices used in Automated Testing
    \target target-android-devices-in-rta

    Below is a list of Android devices in automated testing of Qt for Android
    releases, it is inclusive of \b {but not limited to} these devices:

    \table 50%
    \header \li Device \li OS Version \li Architecture \li Form Factor
    \row \li \l{Pixel 2}
        \li Android 11 (API 30)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 2 XL}
        \li Android 11 (API 30)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 4A}
        \li Android 12 (API 31)
        \li armv7, arm64_v8a
        \li Mobile
    \row \li \l{Pixel 6}
        \li Android 13 (API 33)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 6 Pro}
        \li Android 12 (API 31)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 6a}
        \li Android 14 (API 34)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 7}
        \li Android 13 (API 33)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 7 Pro}
        \li Android 13 (API 33)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 7a}
        \li Android 14 (API 34)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Samsung Galaxy S10}
        \li Android 9 (API 28)
        \li armv7, arm64_v8a
        \li Mobile
    \row \li \l{Samsung Galaxy S21}
        \li Android 12 (API 31)
        \li armv7, arm64_v8a
        \li Mobile
    \row \li \l{Samsung Galaxy Tab S4}
        \li Android 10 (API 29)
        \li armv7, arm64_v8a
        \li Tablet
    \row \li \l{Nothing Phone 1}
       \li Android 14 [UP1A.231005.007] (API 34)
       \li arm64_v8a
       \li Mobile
    \row \li \l{Motorola Moto G5 Plus}
       \li Android 8 [UP1A.230519.001] (API 27)
       \li arm64_v8a
       \li Mobile
    \row \li \l{Samsung Galaxy Tab A9+}
       \li Android 14 [UP1A.231005.007] (API 34)
       \li arm64_v8a
       \li Tablet
    \row \li \l{Pixel 6a}
        \li Android 15 [AP3A.241105.007] (API 35)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel 8}
        \li Android 15 [AP3A.241105.007] (API 35)
        \li arm64_v8a
        \li Mobile
    \row \li \l{Pixel Tablet}
        \li Android 15 [AP3A.241105.007] (API 35)
        \li arm64_v8a
        \li Tablet
    \endtable

    \note The above table is accurate at the time of this Qt patch release only.
    It may change during the patch release cycle and should only be used as a
    reference for what the Qt Company can rapidly reproduce bugs on.
*/