Android Run Settings

Specify settings for running applications on the Run device that you select for a kit in Projects > Build & Run > Run > Run Settings.

To run and debug an application on an Android device, you must create connections from the development host to the device, as instructed in Connecting Android Devices.

am Start Options

Qt Creator applies a default set of Android Activity manager (am) start options when starting applications. You can specify additional start options in the Activity manager start arguments field. However, if the default options conflict with the added options, the application might not start.

The default arguments for the Activity manager for a normal run:

am start -n <package_name>/<QtActivity_name>

The default arguments for the Activity manager for the debugger mode:

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

For example, to run the application as a particular user, enter the start option --user 10, where 10 is the user ID of the user account.

{Run Settings for an Android device}

Shell Commands

You can specify shell commands to run before the application starts and after it quits. For example, enter the following commands into Pre-launch on-device shell commands to unlock the screen and to switch to the user account 10 on the device before running the application:

input keyevent 82
am switch-user 10

Enter the following commands into Post-quit on-device shell commands to switch back to the default user, 0, and to unlock the screen after the application is quit:

am switch-user 0
input keyevent 82

See also Activate kits for a project, Configure projects for running, and Connecting Android Devices.

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