qt_android_package_name

应用程序的软件包名称。

此属性在 Qt 6.8 中引入。

注意: 该属性仅用于 Android 平台。

指定应用程序的软件包名称。这通常是应用程序的唯一点分隔名称,用于在设备上或 Play Store 中识别应用程序。例如,"org.qtproject.gallery"。

set_target_properties(${target} PROPERTIES
    QT_ANDROID_PACKAGE_NAME "org.qtproject.gallery"
)

该属性设置的软件包名称将作为namespace 属性传递给build.gradle 文件,而不是AndroidManifest.xml ,因为后者在 Android Gradle Plugin 7.4 中已被弃用。

软件包名称会将某些单词或字符视为非法,如果遇到这样的名称,编译过程会将其清除。下划线 (_) 将取代非法字符或附加到非法单词上。

  • 允许使用的字符:字母数字、下划线或点 [a-zA-Z0-9_.]。
  • 非法词语:abstract、continue、for、new、switch、assert、default、if、package、synchronized、boolean、do、goto、private、this、break、double、implements、protected、throw、byte、else、import、public、throws、case、enum、instanceof、return、transient、catch、extends、int、short、try、char、final、interface、static、void、class、finally、long、strictfp、volatile、const、float、native、super、while。

Qt XML for Android 应用程序的默认软件包名称是org.qtproject.example.<target_name>

注意: build.gradle (通过namespace 属性)中手动设置软件包名称优先于AndroidManifest.xml (通过package 属性),后者也优先于该属性。

更多信息,请参阅 Android 的配置应用程序模块

另请参阅 qt_android_generate_deployment_settings()

© 2025 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.