This is a manual cherry-pick from
5efbfcb032d801c7083d4a850d0279a075de7f1a
The function allows setting additional permission attributes like
minSdkVersion and maxSdkVersion. The function's implementation is such
that it should work alongside the older way of directly setting the
QT_ANDROID_PERMISSIONS target property.
Task-number: QTBUG-129944
Task-number: QTBUG-117358
Task-number: QTBUG-112164
Change-Id: I0f40692574848fccdf65f9baedd14351917ce4bf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5efbfcb032d801c7083d4a850d0279a075de7f1a)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Those are generally not in any import path. So far, qmlimportscanner
generates invalid "path" entries for file and directory imports, causing
androiddeployqt to skip them early on. androiddeployqt should rather not
try to read them at all. Then we can fix qmlimportscanner.
Change-Id: Ic87a10bee5845a6b10ee902ba28aed5c060956f0
Task-number: QTBUG-126632
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 67ae983d1e9c75bf31d6fada0b667cfbe2f3fc0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Allow using the follow arguments after '--sign' argument in
androiddeployqt. The previous fix had no effect since we should
consider the argument count first and the type of arguments next.
Amends 9c56a77027db2fedfc2b50f96ceaee5003a7d383
Fixes: QTBUG-128254
Task-number: QTBUG-109619
Pick-to: 6.7 6.5
Change-Id: I34eac4def94c1d0c8d304f383d60c1e21b7dc6a2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fd2c408af2f300e100d94a386743c7cbe74fadef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The Java QtQmlComponent has been renamed to QtQuickViewContent
as a part of API reviews.
As a result, we also change the opt-in flag
From QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
To QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS
that adds an entry to the android-deployment-settings.json.
The flags later will be used by androiddeployqt to enable the
generation of QtQuickViewContent extensions.
Task-number: QTBUG-126976
Task-number: QTBUG-127091
Change-Id: Ie08a9430a5e5a16809f78389144a4a6dfd87ce18
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit be2c03064cdb7bef977d05371e535bedcadb3a0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Whe the QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS flag is present the
AndroidDeployQt generates nested classes with the same name as target
and QML module names. When the target name is the same as the QML module
name, the code gets generated successfuly but will fail at compile-time
in the target user project.
With this fix, we detect such cases and fail early, providing a proper
output message
Fixes: QTBUG-125160
Change-Id: I6303d76bc437f7eee806e4429bef81b5fbeb1e27
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit abfeb4542c9107fa40511209d25bc7d0b5db1a8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
By extending IteratorFlag so that it replaces both QDir::Filter and
QDirIterator::IteratorFlag enums, but with better defaults (based on how
QDir/Iterator is used in 15-20 years worth of code in Qt and KDE).
Make the QDirListing(QDir ~~) ctor private, also change it to use
QDirIterator::IteratatorFlags; it will be used to port existing code.
If QDir is ported to use QDirListing::IteratorFlags, instead of
QDir::Filters, a public QDirListing(QDir) constructor can then be added.
Fixes: QTBUG-125504
Task-number: QTBUG-125859
Change-Id: Ide4ff8279f554029ac30d0579b0e8373ed4337f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e583c3d5163a5512abac85e32359652e28a053f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The parameter buildPath comes from QDir:absolutePath(), which gives a
path that starts with '/' or a drive speficiation. When calling
getImportPaths on a Windows machine the path becomes something like
"/C://dev/qt5/...". As a result, androiddeployqt exists with a failure.
On Linux/macOS systems this was not a problem because // = /
Change-Id: I85376253055549344f06c9da9ebd67364e429112
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 776982a14e53e8661c3508c3d05e0efe538bc67e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The QtQmlComponent class is a public Java API in Qt Declarative.
ADQt extracts QML dom info using qmldom tool, and creates concrete
classes, extending QtQmlComponent, by implementing abstract methods
of it, based on target lib, QML modules & QML components.
Additionally, it iterates properties and signals of each component
and adds get/set/connect methods with appropriate arg/return value
types, to each component. Java class generation will be invoked if
generate-java-qml-components is true in the deployment settings
file.
The generated classes will be in the same package name as the target.
If the leaf part of the package has the same name as the target,
a new .java file will be created for each module, else Java code
for all modules will be generated under a root level static class
with the same name as the target name in a single .java file with
the same name as the target name.
The first letter of target name & module names get caplitalized
to match Java naming convension.
Task-number: QTBUG-124846
Change-Id: I1f94e059a6573991c991bccc32838a211f3ee456
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
... to avoid coloring mismatch in the generated doc page
of the tool.
Change-Id: I4334d49632c5f119a874e9112d4f13cd4d60e27a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Bump the minimum supported Android API from 23 to 28 i.e.
Android Oreo 9. This is done to focus more and more on
recent versions.
Fixes: QTBUG-125023
Task-number: QTBUG-124890
Change-Id: I4d510b771f413e5711dd44de454211e019c63db6
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Allow setting the package name directly from CMake properties.
If the package name is not set manually under AndroidManifest.xml
nor build.gradle, then the value set by this property is used.
The value is passed to build.gradle as "namespace" which is the
way to set the package name after AGP 7.4 instead of
AndroidManifest.xml "package" attribute.
Task-number: QTBUG-106907
Change-Id: I94bd73c294d751eabfd96c0a10a6b3ff270d8137
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Make the method handle all the different possible
paths in a more clean way.
Task-number: QTBUG-116955
Task-number: QTBUG-65567
Change-Id: If0ed1b529011b942c0fb67d0ad7a940896e03c85
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This adds new aar target, as we do with apk targets, and an option
to androiddeployqt, --build-aar, which builds an AAR instead of APK.
AndroidManifest.xml of an AAR does not include application or activity
nodes, so we add an AAR specific manifest. Also the plugin type in
build.gradle will be com.android.library when choosing to build an
AAR.
Task-number: QTBUG-116955
Task-number: QTBUG-65567
Change-Id: Id33ac236f44038a8411ebfecdcc4e404c976e277
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This allows to later change the plugin type based on the options
provided for the androiddeployqt, such as when building an AAR.
Task-number: QTBUG-116955
Task-number: QTBUG-65567
Change-Id: I6314c8ab9edccbf953ae48543d5a002a9f807581
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
AGP version 7.4 deprecated the use of "package" attribute in the
manifest to specify the unique package name, it's instead been
moved to build.gradle file and set using "namespace" property.
This patch adds support of that to androiddeployqt.
Removing the "package" attribute from the default manifest would
break Qt Creator 13 and below because Qt Creator would fail to
deploy apps without such attribute in the manifest. For that reason
we'll defer removing it until a later version, for example Qt 6.10,
to allow some buffer for a Qt Creator that can handle that to be
adopted by users to reduce breakage.
[ChangeLog][Android] Add support for namespace in build.gradle instead
of the package attribute in the manifest.
Pick-to: 6.7
Task-number: QTBUG-106907
Change-Id: Ib0f0d6a6fbb3b38f605aadfdcc497067daf90297
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Coverity found several FILE* leaks (since fixed) in the code, so make
sure that those can't happen anymore, by using unique_ptr to manage
the pclose() of the openProcess() FILE handles.
Keep the actual type of the unique_ptr instantiation local to
openProcess() so that creation and destruction are defined close
together, notwithstanding the occasional explicit pclose() calls to
capture the error code.
As a drive-by, port a naked popen() to openProcess(), make some
variables const and replace 0 with nullptr.
Pick-to: 6.7 6.5
Coverity-Id: 378357
Coverity-Id: 378442
Change-Id: I2b06b99cba1e4eb5b8963a9c5d2cb398eb25a8b3
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Found by Coverity.
This code predates the move of androiddeployqt to qtbase.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Coverity-Id: 378442
Change-Id: Icc24918159132c55a3817eaf19c96ea212dfa6dc
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Use QDirListing in the Bootstrap build instead of QDirIterator.
Drive-by changes:
- more const variables
- use emplace_back() instead of append() where appropriate
Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code inside the loop body uses it.next() twice, however hasNext() is
called only once; each call to next() advances the iterator.
Amends 4041610cb202699a47268975e5aaecaa1f182c0a.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Idb96cfbddc56e0d7ed38ab1b0279f40592c75175
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
qt_import_plugins allows to control application deployment on
non-Android platforms. This adds support for the pre-defined plugin list
that is computed using the qt_import_plugins input.
Task-number: QTBUG-118829
Change-Id: Iaa9c3f600533a4b5a3079ab228fabf212d9ce5a5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
[ChangeLog][Android][Deployment Changes] Now the auxillary mode
of androiddeployqt also copies the templates and the stdcpp lib
file without building the APK.
Fixes: QTBUG-115241
Change-Id: I3d4647277e7f62f079c683645443462ef8026948
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This fixes a regression compared to Qt5. In Qt5 absoluteFilePath()
unconditionally searched for all files in extra prefix dirs and the Qt
install prefix, in particular also the -android-dependencies.xml files.
After the changes in Qt6 up to now however those files are only searched
in the Qt install prefix. This broke external libraries also making
use of the -android-dependencies.xml mechanism, such as some KDE
frameworks.
Pick-to: 6.5 6.6
Change-Id: Ic53aab50c70f853f3b1d621d6de6edb3df223905
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
To follow latest Play Store requirement.
Pick-to: 6.6.0 6.6 6.5
Fixes: QTBUG-112637
Change-Id: I1ef4f8b639f4b0cc759a2363b7b9b9864b159509
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
When collecting plugins required for the android application according
to linked targets we should take into account all prefix directories.
But not only the first one. Otherwise the order we use when adding
paths to extraPrefixDirs will affect collecting of the plugins. This
specifically leads to the issue if the user project builds custom Qt
plugins. The plugin directory from user project build tree will be
found first and all plugins from Qt installation directory are
discarded.
Pick-to: 6.6 6.5
Fixes: QTBUG-116920
Change-Id: Id94ebaf5ccd1a279a74b38b59ff535f45230e1b4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Commit 9db5ca87897340873a4606c651a37e0356e8f1a0 sets the default
qtDataDirectory to the value of qtInstallDirectory, which results in an
invalid path when appended to the SDK. This results in build failures
for Android when building with qbs. cmake builds are not affected as
the data directory is explicitly set in the build scripts.
Pick-to: 6.6 6.5
Change-Id: Ia29c5bae7648f5fccefe019c225e187985bd2592
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Some platform sdk packages have names that contains non-integer
characters such as android-33-ext5 or android-UpsideDownCake
which fail building with androiddeployqt because build.gradle
expects an integer only. This allows using string based versions
and also fallbacks to setting an integer only value if it finds
that the build.gradle of the project is still explicitly
converting to integer (this to avoid breaking existing projects).
Fixes: QTBUG-112465
Pick-to: 6.5 6.2 5.15
Change-Id: If8cfc0fb84f0880a43644dc0a4188671736d3e21
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Fix the qtforandroid (i.e. libplugins_platforms_qtforandroid) check
and avoid calling llvm-readobj on non-library files and only add them
to the dependency list.
Task-number: QTBUG-94232
Pick-to: 6.2 6.5
Change-Id: Id1a415b6d9834daaf5337e9bd15e7daf69fd574f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
avoid breaking when looking for the android plugin when the dependencies
include opengl lib, since that was valid only in the early days where
the Android plugin was separated into two raster and opengl. Now, that
assumption is wrong and might affect the way the manual dependency
works.
Task-number: QTBUG-94232
Pick-to: 6.2 6.5 5.15
Change-Id: I025a5c8b2b064bb43a356a4ad5cb4a1ada41b09b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Play Store now accept only app with target
SDK version set to 31 or above
Change-Id: I7f7fb677798c3f2d3ce327226ac13a69f0bab442
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Make the error message clearly mention that a Qt for Android app
require linking to Qt Gui library.
Along the way get rid of the libqtforandroidGL mention which
was valid when Qt for Android had separate plugins for raster
and opengl, which was removed some time ago in
8a9bd001c947e6888d37e99fc456339fd2b51b36.
Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-111933
Task-number: QTBUG-111934
Task-number: QTBUG-108643
Task-number: QTBUG-97636
Task-number: QTBUG-83997
Fixes: QTBUG-85544
Task-number: QTBUG-93185
Change-Id: I24f6c08f619d805e0d82758d35aebaf32038206c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
There was a possibility of infinite loop and eventually crash when
androiddeployqt was used for the second time. Everything because of
deleteMissingFiles function for clean up previous build.
When we find the same names and those are directories, we call
recursively deleteMissingFiles. The parameters we use are absoluteDir,
not absoluteFilePath. As we use parent of found dir, deleteMissingFiles
is called with the same values as before.
This commit removes possibility of infinite loop by using
absoluteFilePath. That allows to avoid calling deleteMissingFiles with
the same parameters.
There is still a possibility, that directory that was found is not the
same as we were looking for. That will cause not needed files removing,
but those file will be copied again later.
This regression was created by 7dc05252a0df829bb5ea3994160d425bb0da26cb
commit
Pick-to: 6.5 6.2
Fixes: QTBUG-111027
Change-Id: I195b4c407068b14e2ef94800ad1945adc66408cb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This reverts commit d7e8d5bb1b5a9c4b21a3d824780c672eaf4e56b1.
Reason for revert: Found a working solution for the issue.
Change-Id: Ia720cc63ece9dfb1a24067cdd9c3d79d4edbe3be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Right now, "multi abi builds" of android projects works only if the
android-build installation doesn't use custom install dirs
(INSTALL_PREFIX, INSTALL_BINDIR...)
At the same time, it fixes QTBUG-106533. The patches are the same as the
ones in that bugreport.
Add new items to android-*-deployment-settings.json:
qtDataDirectory
qtLibsDirectory
qtLibExecsDirectory
qtPluginsDirectory
qtQmlDirectory
Update androiddeployqt to be able to get files from their install location
BTW (fixes QTBUG-106533):
Install src/android/templates into INSTALL_DATADIR
Install src/3rdparty/gradle into INSTALL_DATADIR
Install src/android/java files into INSTALL_DATADIR
Install all jars into INSTALL_DATADIR
Add missing path to target_qt.conf
Update target_qt.conf to have all path. Otherwise qmake wouldn't have
the path when installing the android-build with custom install dirs
like INSTALL_LIBDIR & friends
Add support for a new cmake variable that can be set at build time of the
android projects: QT_ANDROID_PATH_CMAKE_DIR_${abi} (Name chosen as
brother of QT_HOST_PATH_CMAKE_DIR)
Pick-to: 6.5
Fixes: QTBUG-106533
Fixes: QTBUG-107207
Change-Id: Ia3751362ab1b5f877ecafbe02f263feac167119c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The '--sign' argument may and may not accept two follow arguments
to specify signing path and alias from the command line. This
functionality breaks the parsing of command line arguments that
follow the '--sign' argument and expect that '--sign' is used with
no follow arguments. It does make sense to check if the arguments
passed after the --sign staring with '--' to make sure that '--sign'
with no arguments is meant to be used.
Pick-to: 6.4 6.5
Fixes: QTBUG-109619
Change-Id: I4ee7fe953e5378c00760d84ec58f9e89e4348944
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
On each run of androiddeployqt involving gradle, the "merging" of
gradle's *.properties files inserted empty lines.
Change-Id: I7a8314cd0adf4d85663f17ac22967a08cab42b91
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When resolving QML module dependencies we scan the produced by the
build system import paths for the required QML modules. Previously the
check in androiddeployqt only was confirming that the required import
starts with the one of import paths. This worked well unless the
required import is nested in higher level import path. In the situation
when we have the following build structure:
build_dir/
imports/
MyModule/
...
and both 'build_dir' and 'build_dir/imports' directories are in QML
import paths, the MyModule QML module is resolved by the
'build_dir/imports'. But androiddeployqt assumed that it's found by
'build_dir' import path and copied the whole 'imports' directory as
the 'MyModule' QML module. The resulting bundle then had the
following content:
qml/
imports/
MyModule/
...
...
instead of the correct one:
qml/
MyModule/
...
...
This checks if import path contains the required url-based module
path before using it as the base directory to copy the module.
Amends 0a73fb10005053945571e6cdb0b03d916715c112
Pick-to: 6.2 6.4
Fixes: QTBUG-108194
Change-Id: I79e1a8a67f62e5ae4a899ba1a4f49ee4ad44ebf9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
The 'qml-root-path' option is not mandatory to have value when using
CMake, even if Qml/Quick is used in the project. This happens when
the project doesn't use .qml files. In this case the 'qml' directory
from Qt6Quick_<abi>-android-dependencies.xml is treated as a normal
folder for scanning and androiddeployqt deploys all the QML plugins
with their dependencies.
It looks like the 'qml' directory was added to bundled file in times
when qmlimportscanner was not implemented, so the need of its use is
redundant. This removes both adding the 'qml' directory as the bundled
dependency and the special case that avoids its scanning. This fix is
applicable for both CMake and qmake.
Amends 54c959643ea92c0b87a7807c64f2351328cdce7d
Task-number: QTBUG-106035
Task-number: QTBUG-107589
Change-Id: Idd55617b8ca8ab1d210cce737548ee486ea94986
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The check doesn't affect the flow, since the same check fails the
androiddeployqt execution later, when resolving all elf dependencies.
Skipping the dependency from xml at earlier stage will allow to continue
deployment procedure, without the missing plugins and their dependencies.
Amends 54c959643ea92c0b87a7807c64f2351328cdce7d
Task-number: QTBUG-106035
Task-number: QTBUG-107589
Change-Id: Ic3d38e05f8ad283244c87858fee29d1035a0da15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
To simplify matters, this removes the support for signing APKs with
just jarsigner. apksigner is always used for APKs, and jarsigner is
used for AABs. I consider that to be just fine, you _have_ to start
using apksigner eventually, and the time for that is long past.
Pick-to: 6.4 6.2 5.15
Task-number: QTBUG-91255
Change-Id: I211ae796db0f2619265deb1f30ab3cc5d1ecfbc9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
If Qml module is not found it doesn't make sense to run any
functionality that is related to Qml inside androiddeployqt. Add the
deployment setting option that indicates this explicitly and set it
to true when Qml module is not found by CMake or by qmake.
Task-number: QTBUG-106939
Pick-to: 6.4 6.2
Change-Id: I1e6cffbdd230007feffe7448617097c10238a6c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>