qt_android_add_apk_target

Defines a build target that runs androiddeployqt to produce an APK.

The command is defined in the Core component of the Qt6 package. Load the package with:

find_package(Qt6 COMPONENTS Core REQUIRED)

Note: This command is in technology preview and may change in future releases.

Note: This command should only be called if targeting the Android platform.

Synopsis

qt_android_add_apk_target(target)

If versionless commands are disabled, use qt6_android_add_apk_target() instead. It supports the same set of arguments as this command.

Description

The <target>_make_apk custom target created by this command takes an Android deployment settings file and generates an APK by running androiddeployqt. The location of the settings file is taken from the target's QT_ANDROID_DEPLOYMENT_SETTINGS_FILE property. This file is typically created by qt_android_generate_deployment_settings(). The .apk file will be generated in an android-build subdirectory below the CMake build directory of the target.

The <target>_make_apk target will be automatically added as a dependency of the apk build target, which will be created if it doesn't already exist. This can be disabled by setting the QT_NO_GLOBAL_APK_TARGET variable to true.

Example

qt_android_generate_deployment_settings(myapp)
qt_android_add_apk_target(myapp)

The above commands define the build targets myapp_make_apk and apk, which can be used to generate just the myapp APK or all APKs in the project respectively.

See also qt_android_generate_deployment_settings() and qt_finalize_target().

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.