DEV Community

Vlad-Raul Guran
Vlad-Raul Guran

Posted on Originally published at vladguran.github.io

ADB Command Cheat Sheet: Android & Google TV Debugging, Debloating, and Device Control

Every ADB command you actually use for phones and Android/Google TV over USB or Wi-Fi. Targets Android SDK Platform-Tools 35+ (adb version โ†’ 1.0.41) with devices on Android 11โ€“15.

Quick Reference

Task Command
List devices with model info adb devices -l
Target a specific device adb -s <serial> <cmd> (or export ANDROID_SERIAL=<serial>)
Pair over Wi-Fi (Android 11+) adb pair <ip>:<pair-port>
Connect over Wi-Fi adb connect <ip>:<port>
Install or update an APK adb install -r -g app.apk
Install split APKs adb install-multiple base.apk split_*.apk
Uninstall an app adb uninstall <pkg>
List third-party packages adb shell pm list packages -3
Launch an app by package adb shell monkey -p <pkg> -c android.intent.category.LAUNCHER 1
Force-stop an app adb shell am force-stop <pkg>
Clear app data adb shell pm clear <pkg>
Stream errors only adb logcat *:E
Take a screenshot to the host adb exec-out screencap -p > shot.png
Send a remote or hardware key adb shell input keyevent KEYCODE_HOME
Copy files adb push local /sdcard/ ยท adb pull /sdcard/file .

Core Patterns

1. Wireless Connection (Phones & Google TV)

Android 11+ uses TLS pairing through Wireless debugging. Older devices, and many TVs, use the legacy TCP mode. That mode either starts from USB, or is enabled by turning on USB/network debugging on the TV itself.

# Android 11+: Developer options > Wireless debugging > Pair device with pairing code
adb pair 192.168.1.50:37123        # pairing port + 6-digit code shown on device
adb connect 192.168.1.50:41567     # DIFFERENT port: shown on main Wireless debugging screen
adb mdns services                  # discover advertised devices on the LAN

# Legacy (any version): start on USB, then switch to TCP
adb -s <usb-serial> tcpip 5555
adb connect 192.168.1.50:5555

# Google TV / Android TV: Settings > System > About > tap "Android TV OS build" 7x,
# enable USB debugging in Developer options, then:
adb connect 192.168.1.60:5555      # accept the RSA prompt on the TV screen
adb disconnect 192.168.1.60:5555
Enter fullscreen mode Exit fullscreen mode

2. App Lifecycle: Install, Launch, Measure, Reset

Script the full cycle so every QA run starts from a known state.

adb install -r -g -t app-debug.apk               # replace, grant runtime perms, allow test APKs
adb shell pm path com.example.app                # where the APK lives
adb shell dumpsys package com.example.app | grep -E 'versionName|versionCode'
adb shell cmd package resolve-activity --brief com.example.app   # find launcher activity
adb shell am start -S -W -n com.example.app/.MainActivity        # cold start + timing
adb shell am start -a android.intent.action.VIEW -d "myapp://item/42"   # deep link
adb shell am force-stop com.example.app
adb shell pm clear com.example.app               # wipe data + revoke perms
adb shell pm grant com.example.app android.permission.POST_NOTIFICATIONS
adb shell pm revoke com.example.app android.permission.CAMERA
Enter fullscreen mode Exit fullscreen mode

Launch week: both sheets are 30% off until Thu, Oct 23, 10:00 UTC, applied automatically at checkout.

This is the free part. The full ADB Command Cheat Sheet: Android & Google TV Debugging, Debloating, and Device Control (production commands, best practices, common pitfalls and a debugging checklist on 2โ€“4 dense pages) is available as a PDF, pay what you want: https://guranova.gumroad.com/l/kdxze

More sheets: https://vladguran.github.io/dev-cheatsheets/

This article was written with AI assistance.

Top comments (0)