Category Archives: Android

Paste text into Android emulator or device

$ adb shell input text 'text to paste'
  • For convenience, add the path to adb to PATH environment variable.
    You can find the path to adb in Android Studio [Project Sturcture] > [SDK Location]
  • If multiple devices are connected, specify the serial number of the device by -s option.
    The serial number of the device can be found like below.

    $ adb devices
    
  • Althogh I enclose the text to paste with single quotation marks ('), metacharacters or $0, $1... are extracted by the shell. You should escape them with backslash (\).

Example:

$ adb -s emulator-5554 shell input text 'text to paste'