$npx -y skills add hyperb1iss/hyperdroid-skill --skill androidUse when working with Android devices via ADB - connecting devices, running shell commands, installing apps, debugging, taking screenshots, UI automation, viewing logs, analyzing crashes, or exploring system internals. Triggers on "adb", "logcat", "install apk", "debug android",
| 1 | # Android Device Mastery |
| 2 | |
| 3 | This skill covers everything about interacting with Android devices via ADB and shell commands. |
| 4 | |
| 5 | ## Device Connection |
| 6 | |
| 7 | ### Check Connected Devices |
| 8 | |
| 9 | ```bash |
| 10 | adb devices -l |
| 11 | ``` |
| 12 | |
| 13 | Output shows serial, status, and device info. Common statuses: |
| 14 | |
| 15 | - `device` - Connected and authorized |
| 16 | - `unauthorized` - Accept USB debugging prompt on device |
| 17 | - `offline` - Connection issues, try `adb kill-server && adb start-server` |
| 18 | |
| 19 | ### Wireless Debugging |
| 20 | |
| 21 | **Android 11+ (Recommended):** |
| 22 | |
| 23 | 1. Enable Wireless debugging in Developer Options |
| 24 | 2. Tap "Pair device with pairing code" |
| 25 | 3. Run: `adb pair <ip>:<pairing_port>` and enter the code |
| 26 | 4. Then: `adb connect <ip>:<connection_port>` |
| 27 | |
| 28 | **Legacy (requires USB first):** |
| 29 | |
| 30 | ```bash |
| 31 | adb tcpip 5555 |
| 32 | adb connect <device_ip>:5555 |
| 33 | ``` |
| 34 | |
| 35 | ### Multiple Devices |
| 36 | |
| 37 | Always specify device with `-s`: |
| 38 | |
| 39 | ```bash |
| 40 | adb -s <serial> shell |
| 41 | adb -s emulator-5554 install app.apk |
| 42 | ``` |
| 43 | |
| 44 | --- |
| 45 | |
| 46 | ## Shell Commands |
| 47 | |
| 48 | ### Interactive Shell |
| 49 | |
| 50 | ```bash |
| 51 | adb shell # Enter shell |
| 52 | adb shell <command> # Run single command |
| 53 | adb shell "cmd1 && cmd2" # Chain commands |
| 54 | ``` |
| 55 | |
| 56 | ### Essential Commands |
| 57 | |
| 58 | ```bash |
| 59 | # Device info |
| 60 | getprop ro.product.model # Device model |
| 61 | getprop ro.build.version.release # Android version |
| 62 | getprop ro.build.version.sdk # SDK level |
| 63 | |
| 64 | # File operations |
| 65 | ls -la /sdcard/ |
| 66 | cat /path/to/file |
| 67 | cp /source /dest |
| 68 | rm /path/to/file |
| 69 | |
| 70 | # Process info |
| 71 | ps -A | grep <name> |
| 72 | pidof <package_name> |
| 73 | top -n 1 -m 10 |
| 74 | ``` |
| 75 | |
| 76 | ### Safe Output Limiting |
| 77 | |
| 78 | For commands with potentially large output: |
| 79 | |
| 80 | ```bash |
| 81 | adb shell "logcat -d | head -500" |
| 82 | adb shell "dumpsys activity | head -200" |
| 83 | ``` |
| 84 | |
| 85 | --- |
| 86 | |
| 87 | ## App Management |
| 88 | |
| 89 | ### Install/Uninstall |
| 90 | |
| 91 | ```bash |
| 92 | adb install app.apk # Basic install |
| 93 | adb install -r app.apk # Replace existing |
| 94 | adb install -g app.apk # Grant all permissions |
| 95 | adb install -r -g app.apk # Both |
| 96 | |
| 97 | adb uninstall com.example.app # Full uninstall |
| 98 | adb uninstall -k com.example.app # Keep data |
| 99 | ``` |
| 100 | |
| 101 | ### Start/Stop Apps |
| 102 | |
| 103 | ```bash |
| 104 | # Start main activity |
| 105 | adb shell monkey -p com.example.app -c android.intent.category.LAUNCHER 1 |
| 106 | |
| 107 | # Start specific activity |
| 108 | adb shell am start -n com.example.app/.MainActivity |
| 109 | |
| 110 | # Start with intent extras |
| 111 | adb shell am start -n com.example.app/.Activity \ |
| 112 | -a android.intent.action.VIEW \ |
| 113 | -d "myapp://page/123" \ |
| 114 | --es "key" "value" |
| 115 | |
| 116 | # Force stop |
| 117 | adb shell am force-stop com.example.app |
| 118 | |
| 119 | # Clear app data |
| 120 | adb shell pm clear com.example.app |
| 121 | ``` |
| 122 | |
| 123 | ### List Packages |
| 124 | |
| 125 | ```bash |
| 126 | adb shell pm list packages # All packages |
| 127 | adb shell pm list packages -3 # Third-party only |
| 128 | adb shell pm list packages | grep term # Filter |
| 129 | |
| 130 | adb shell pm path com.example.app # APK location |
| 131 | adb shell dumpsys package com.example.app # Full package info |
| 132 | ``` |
| 133 | |
| 134 | ### Permissions |
| 135 | |
| 136 | ```bash |
| 137 | adb shell pm grant com.example.app android.permission.CAMERA |
| 138 | adb shell pm revoke com.example.app android.permission.CAMERA |
| 139 | adb shell dumpsys package com.example.app | grep permission |
| 140 | ``` |
| 141 | |
| 142 | --- |
| 143 | |
| 144 | ## File Operations |
| 145 | |
| 146 | ### Push/Pull Files |
| 147 | |
| 148 | ```bash |
| 149 | adb push local_file.txt /sdcard/ |
| 150 | adb pull /sdcard/remote_file.txt ./ |
| 151 | |
| 152 | # Recursive |
| 153 | adb push local_dir/ /sdcard/target/ |
| 154 | adb pull /sdcard/dir/ ./local/ |
| 155 | ``` |
| 156 | |
| 157 | ### Access App Data (Debuggable Apps) |
| 158 | |
| 159 | ```bash |
| 160 | adb shell run-as com.example.app ls files/ |
| 161 | adb shell run-as com.example.app cat shared_prefs/prefs.xml |
| 162 | adb shell run-as com.example.app sqlite3 databases/app.db ".tables" |
| 163 | ``` |
| 164 | |
| 165 | --- |
| 166 | |
| 167 | ## UI Automation |
| 168 | |
| 169 | ### Input Commands |
| 170 | |
| 171 | ```bash |
| 172 | # Tap at coordinates |
| 173 | adb shell input tap 500 800 |
| 174 | |
| 175 | # Swipe (x1 y1 x2 y2 [duration_ms]) |
| 176 | adb shell input swipe 500 1500 500 500 300 |
| 177 | |
| 178 | # Text input (needs focused field) |
| 179 | adb shell input text "hello" |
| 180 | |
| 181 | # Key events |
| 182 | adb shell input keyevent KEYCODE_HOME # Home |
| 183 | adb shell input keyevent KEYCODE_BACK # Back |
| 184 | adb shell input keyevent KEYCODE_ENTER # Enter |
| 185 | adb shell input keyevent KEYCODE_POWER # Power |
| 186 | adb shell input keyevent KEYCODE_VOLUME_UP # Volume up |
| 187 | ``` |
| 188 | |
| 189 | ### Common Keycodes |
| 190 | |
| 191 | | Code | Key | Code | Key | |
| 192 | | ---- | ------ | ---- | -------- | |
| 193 | | 3 | HOME | 4 | BACK | |
| 194 | | 24 | VOL_UP | 25 | VOL_DOWN | |
| 195 | | 26 | POWER | 66 | ENTER | |
| 196 | | 67 | DEL | 82 | MENU | |
| 197 | |
| 198 | ### Screenshots & Recording |
| 199 | |
| 200 | ```bash |
| 201 | # Screenshot |
| 202 | adb shell screencap -p /sdcard/screen.png |
| 203 | adb pull /sdcard/screen.png |
| 204 | |
| 205 | # One-liner (binary-safe) |
| 206 | adb exec-out screencap -p > screen.png |
| 207 | |
| 208 | # Screen recording (max 3 min) |
| 209 | adb shell screenrecord /sdcard/video.mp4 |
| 210 | adb shell screenrecord --time-limit 10 /sdcard/video.mp4 |
| 211 | ``` |
| 212 | |
| 213 | ### UI Hierarchy |
| 214 | |
| 215 | ```bash |
| 216 | adb shell uiautomator dump /sdcard/ui.xml |
| 217 | adb |