| name | android-adb |
| description | Android device control via ADB - screenshots, UI interaction, app management, file transfer, and backup/restore using adb and uiautomator |
Android ADB
Use this skill when interacting with Android devices over USB via ADB — taking screenshots, navigating UI, transferring files, managing apps, or performing backups.
Activation Triggers
Activate this skill when the user mentions:
- ADB, Android Debug Bridge
- Controlling or automating an Android phone
- Taking screenshots of a phone
- Installing or managing Android apps
- Transferring files to/from Android
- Backing up or restoring Android data
- Interacting with a phone's UI programmatically
Environment
- Binary:
adb (from android-tools package)
- Install:
sudo pacman -S android-tools (Arch/CachyOS)
- Prerequisites: USB Debugging enabled on device (Developer Options)
- Multiple devices: Use
-s <serial> to target a specific device
Device Management
adb devices
adb -s <serial> <command>
adb devices | grep -v "List" | awk '{print $1}'
adb kill-server && adb start-server
adb connect <ip>:5555
adb tcpip 5555
Screenshots
Screenshots can be taken and pulled to the local machine. The agent CAN VIEW these screenshots using the Read tool.
adb -s <serial> shell screencap -p /sdcard/screen.png
adb -s <serial> pull /sdcard/screen.png /tmp/screen.png
adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png /tmp/screen.png
Important: After pulling, use the read tool on the local path to view the screenshot. Image coordinates in the displayed image may be scaled — multiply by the scale factor shown to get actual device coordinates.
UI Interaction
Tapping & Input
adb shell input tap <x> <y>
adb shell input swipe <x> <y> <x> <y> 1000
adb shell input swipe <x1> <y1> <x2> <y2> [duration_ms]
adb shell input text "hello world"
adb shell input keyevent 4
adb shell input keyevent 3
adb shell input keyevent 187
adb shell input keyevent 26
UI Hierarchy (Blind Navigation)
Use uiautomator dump to understand what's on screen without seeing it:
adb shell uiautomator dump /sdcard/ui.xml
adb pull /sdcard/ui.xml /tmp/ui.xml
cat /tmp/ui.xml | grep -o 'text="[^"]*"\|bounds="[^"]*"' | paste - -
Parse bounds format [x1,y1][x2,y2] to find tap center:
- center_x = (x1 + x2) / 2
- center_y = (y1 + y2) / 2
Launch Apps
adb shell monkey -p <package> -c android.intent.category.LAUNCHER 1
adb shell am start -n <package>/<activity>
adb shell am start -a android.intent.action.VIEW -d "https://example.com"
App Management
adb shell pm list packages -3
adb shell pm list packages
adb install app.apk
adb install -r app.apk
adb uninstall <package>
adb shell pm clear <package>
adb shell dumpsys package <package> | grep versionName
File Transfer
adb push local_file.txt /sdcard/
adb pull /sdcard/file.txt ./
adb pull /sdcard/DCIM/ ./DCIM/
adb shell ls /sdcard/
Backup & Restore
adb backup -noapk <package> -f backup.ab
adb backup -noapk <pkg1> <pkg2> -f backup.ab
adb backup -all -f full_backup.ab
adb restore backup.ab
Note: User must confirm backup/restore on device screen. adb backup is deprecated but still functional as of Android 16.
SMS / Telephony
adb backup -noapk com.android.providers.telephony -f sms_backup.ab
adb -s <target_serial> restore sms_backup.ab
Shell Access
adb shell
adb shell <command>
adb shell getprop ro.product.model
adb shell getprop ro.build.version.release
adb shell getprop ro.build.version.sdk
adb shell df -h
adb shell ps -A | grep <name>
Logcat
adb logcat
adb logcat -s MyTag
adb logcat *:E
adb logcat -c
Screen Recording
adb shell screenrecord /sdcard/record.mp4
adb pull /sdcard/record.mp4 ./
Common Workflows
Navigate an App Blindly
- Take screenshot → pull → read to see current state
- Dump UI hierarchy to find element coordinates
- Tap element by calculated center coordinates
- Repeat
Diff Apps Between Two Devices
comm -23 \
<(adb -s <serial1> shell pm list packages -3 | sed 's/package://' | sort) \
<(adb -s <serial2> shell pm list packages -3 | sed 's/package://' | sort)
Migrate SMS Between Phones
adb -s <source> backup -noapk com.android.providers.telephony -f sms_backup.ab
adb -s <target> restore sms_backup.ab
GrapheneOS Notes
- USB debugging must be explicitly enabled in Developer Options
- GrapheneOS restricts
adb backup for some system apps — user apps work fine
adb shell run-as <package> may not work without app being debuggable
- USB data blocked when screen locked by default — unlock before connecting