将应用程序部署到 Android
由于将应用程序捆绑为 APK 包并不简单,Qt 提供了androiddeployqt工具。当您使用Qt for Android 套件部署应用程序时,Qt Creator 运行该工具来创建必要的文件并将它们捆绑成 APK。更多信息,请参阅Android 包模板。
要查看androiddeployqt 工具创建的包,请选择Open package location after build 。
指定部署设置
要指定部署应用程序的设置,请访问Projects >Deploy Settings ,然后在Active deployment configuration 中选择一个部署配置。

要为项目添加部署配置,请选择Add 。
要重命名当前部署方法,请选择Rename 。
要删除当前部署方法,请选择Remove 。
关于 Android 部署设置
Android 应用程序打包为 ZIP 文件,称为应用程序包 (APK)、Android 应用程序捆绑包 (AAB) 或 Android 存档 (AAR)。您可以在设备上安装和运行 APK 文件。您可以将 AAB 文件上传到 Google Play 商店。
Qt for Android有适用于 armv7a、arm64-v8a、x86 和 x86-64 的二进制文件。要在应用程序中支持多个不同的 ABI,请构建一个 AAB,其中包含每个 ABI 的二进制文件。Google Play 商店会使用 AAB 为请求下载的设备生成优化的 APK 包,并自动使用您的发布者密钥对其进行签名。
Qt Creator Android 应用程序支持以下部署方法:
- 作为独立的、可分发的应用程序包 (APK)。
- 作为应用程序捆绑包 (AAB) 在 Google Play 商店发布。
- AAR 从根本上不同于 APK 和 AAB 格式,它是一个 Android 库。您可以将其作为 Android 应用程序模块的依赖项,但不能单独运行。
所有 Qt 版本都不支持 AAB。当使用 CMake 构建应用程序时,Qt 6.3.0 及更高版本支持多abi 构建。从 Qt 6.8.0 开始支持 AAR。有关详细信息,请参阅在 Android 上部署应用程序。
要指定应用程序软件包的设置,请访问Projects >Build Settings >Build Android APK 并选择Details 。
有关为应用程序指定其他启动选项的更多信息,请参阅指定 Android 运行设置。
选择要部署的设备
Qt Creator 在套件选择器中选择的 Android 设备上部署软件包。要添加设备,请选择Manage 。

删除以前的安装
要从设备上删除以前安装的文件,请访问Projects >Deploy Settings ,然后选择Uninstall the existing app before deployment 。
安装预置 APK
要在设备上安装预置 APK,例如第三方应用程序,请访问Projects >Deploy Settings 并选择Install an APK File 。
另请参阅 如何:为 Android 开发》和《为 Android 开发》。
Copyright © The Qt Company Ltd. and other contributors. 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.