Make your phone or tablet smarter with automation

Get it on Google Play

ADB shell command

An action block that executes a shell command through ADB, on the local or a remote Android device.

The fiber will pause until the command has completed.

The command should be formatted as it would when executed at a shell prompt, that includes proper escaping. Use the cliEncode function when including a filename or other text as an argument.

A device requires authentication before it allows an ADB host, such as this block, to connect. The host send a 2048-bit RSA public key to the device, which the user has to confirm, thereafter the host uses its private key to sign a “challenge-response”. Click the Install generated key button to create such a key-pair, or create it elsewhere, e.g. with a tool like openssl, then install it in system Security settings. Once an alias of an installed key has been chosen, the system will grant Automate perpetual usage, but the secret/private key material remain inaccessible, e.g. to export or backup.

The standard output and error will contain the full text as generated by the command during its execution. The exit code is usually set to 0 (zero) for a successful execution of the command.

A device needs to be configured to accept TCP/IP connections, please read ADB. A device may only allow a single ADB host to be connected at a time, disconnect the USB cable.

Privacy warning! The ADB protocol is not encrypted, don’t connect to a remote device over a public network.

Input arguments

  • Command — command to execute, including any arguments.
  • Host or IP address — hostname or IP address of Android device, default is localhost.
  • Port — remote port, default is 5555.
  • Keychain alias — alias of an 2048-bit RSA private key and certificate stored in the Android system keychain.

Output variables

  • Standard output text — variable to assign the STDOUT.
  • Standard error text — variable to assign the STDERR.
  • Exit code — variable to assign the exit code.
Note! This documentation is also accessible within the app from Help & feedback menu.