安卓运行设置

Projects >Build & Run >Run >Run Settings 中为套件选择的运行设备上指定运行应用程序的设置。

要在 Android 设备上运行和调试应用程序,必须按照Developing for Android 中的说明,创建从开发主机到设备的连接。

启动选项

Qt Creator 启动应用程序时,会应用一组默认的 Android 活动管理器 (am) 启动选项。您可以在 字段中指定其他启动选项。但是,如果默认选项与添加的选项冲突,应用程序可能无法启动。Activity manager start arguments

正常运行时活动管理器的默认参数:

am start -n <package_name>/<QtActivity_name>

调试器模式下活动管理器的默认参数:

am start -n <package_name>/<QtActivity_name> -D

例如,要以特定用户身份运行应用程序,请输入启动选项--user 10 ,其中10 是用户账户的用户 ID。

运行安卓设备的设置

shell 命令

您可以指定在应用程序启动前和退出后运行的 shell 命令。例如,在Pre-launch on-device shell commands 中输入以下命令,可在运行应用程序前解锁屏幕并切换到设备上的用户帐户10

input keyevent 82
am switch-user 10

Post-quit on-device shell commands 中输入以下命令,切换回默认用户0 ,并在退出应用程序后解锁屏幕:

am switch-user 0
input keyevent 82

另请参阅 "为项目激活工具包"、"配置项目以便运行"、"如何:为 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.