| name | adb-bot |
| description | Use when connecting Android devices, controlling app lifecycle, filtering logs, taking screenshots, pulling files, or checking performance metrics via adb |
ADB Bot
定位:通用 Android adb 调试与设备控制。
触发时机:需要连接设备、启动/停止应用、收集日志、截屏、查看性能指标等基础 adb 操作时启用。
PoLang 专属命令:使用 agent-test(Agent Test)。
UI 自动化:使用 ui-driver(UI Driver)。
快速开始
adb devices
adb shell am start -n com.mamba.picme/.MainActivity
adb shell am force-stop com.mamba.picme
adb logcat -s PoLang:* *:S
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png /tmp/screen.png
设备连接
adb devices
adb -s <serial> shell ...
adb kill-server && adb start-server
应用生命周期
adb shell pidof com.mamba.picme
adb shell am start -n com.mamba.picme/.MainActivity
adb shell am force-stop com.mamba.picme
adb shell pm clear com.mamba.picme
日志
adb logcat -s PoLang:* *:S
adb logcat -c
adb shell am start -n com.mamba.picme/.MainActivity
adb logcat -s PoLang:*
adb logcat -d > /tmp/logcat.txt
grep -iE "error|exception|fatal|failed" /tmp/logcat.txt
UI 交互(基础 fallback)
优先使用 ui-driver,以下命令仅在无法启用 AccessibilityService 时使用。
adb shell input tap 500 1500
adb shell input swipe 300 1000 300 500
adb shell input keyevent KEYCODE_BACK
adb shell input keyevent KEYCODE_CAMERA
adb shell input keyevent KEYCODE_VOLUME_UP
截屏与录屏
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png /tmp/screen.png
adb shell screenrecord /sdcard/video.mp4
adb pull /sdcard/video.mp4 /tmp/video.mp4
文件与数据
adb shell run-as com.mamba.picme cat /data/data/com.mamba.picme/shared_prefs/*.xml
adb shell run-as com.mamba.picme cat /data/data/com.mamba.picme/databases/*.db > /tmp/app.db
adb push test_image.jpg /sdcard/Pictures/
adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/Pictures/test_image.jpg
adb shell uiautomator dump /sdcard/window_dump.xml
adb pull /sdcard/window_dump.xml
性能
adb shell dumpsys gfxinfo com.mamba.picme | grep -iE "jank|frame|percentile"
adb shell dumpsys meminfo com.mamba.picme
adb shell top -p $(adb shell pidof com.mamba.picme) -n 1
Activity / Window
adb shell dumpsys activity top | grep -i "ACTIVITY"
adb shell dumpsys window displays
故障排除
| 症状 | 检查/修复 |
|---|
| 设备未识别 | adb devices;重新插拔 USB;adb kill-server && adb start-server |
| 日志无输出 | 确认 PID 正确;先用 adb logcat -d 全量查看 |
| 截屏失败 | 检查设备连接和 /sdcard/ 可写性 |
| 文件 run-as 失败 | 应用必须是 debug 包;或先 adb shell 再 su |
相关 Skill
版本历史
| 版本 | 日期 | 变更 |
|---|
| 2.0.0 | 2026-07-02 | 统一标题为 ADB Bot;移除 PoLang 专属 TEST_COMMAND 内容,改为通用 adb 参考;指向 Agent Test 和 UI Driver |
| 1.1.0 | 2026-05-31 | 统一格式,添加定位块 |
| 1.0.0 | 2026-05-03 | 初始版本 |