Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device.

Cheat Sheet Link to heading

Check connected devices Link to heading

  • adb devices -l

Send commands to a specific device Link to heading

  • adb -s serial-number command
    • e.g. adb -s emulator-5555 install helloWorld.apk

Install an app Link to heading

  • adb install path-to-apk
    • e.g. adb install ./apk/helloWorld.apk

Stop the adb server Link to heading

  • adb kill-server

Take a screenshot Link to heading

  • adb shell screencap -p path-to-save
    • e.g. adb shell screencap -p /sdcard/screenshot.png

Record a video Link to heading

  • adb shell screenrecord –size resolution path-to-save
    • e.g. adb shell screenrecord –size 1280x720 /sdcard/record.mp4

Copy files to a device Link to heading

  • adb push local remote
    • adb push myfile.txt /sdcard/myfile.txt

Copy files from a device Link to heading

  • adb pull remote local
    • e.g. adb pull /sdcard/screenshot.png

Get proxy server Link to heading

  • adb shell settings get global http_proxy

Set proxy server Link to heading

  • adb shell settings put global http_proxy ip:port
    • e.g. adb shell settings put global http_proxy 192.168.1.10:8888

Reset proxy server Link to heading

  • adb shell settings put global http_proxy :0

Open system settings Link to heading

  • adb shell am start com.android.settings

Generate bug report Link to heading

  • adb bugreport

Simulate home button Link to heading

  • adb shell input keyevent KEYCODE_HOME

Simulate back button Link to heading

  • adb shell input keyevent KEYCODE_BACK

Simulate swith app (overview) button Link to heading

  • adb shell input keyevent KEYCODE_APP_SWITCH

Show/Hide touches (a small circle or dot) Link to heading

  • adb shell settings put system show_touches 1/0

Simulate power button Link to heading

  • adb shell input keyevent KEYCODE_POWER

Simulate sleep/wakeup Link to heading

  • adb shell input keyevent KEYCODE_SLEEP/KEYCODE_WAKEUP