Category Archives: Android

Install Android application package (apk) on your Android device

adb install -r <path to apk>
  • -r replaces existing application
  • 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
    

Example:

$ adb -s emulator-5554 install -r /Users/pistolfly/AndroidstudioProjects/MyApp/app/release/app-release.apk

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'