android-adb

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Android ADB Automation

Android ADB 自动化

Execute Android operations with
scripts/adb_helpers.ts
in the
android-adb
skill directory.
android-adb
skill目录中,通过
scripts/adb_helpers.ts
执行Android操作。

Path Convention

路径规范

Canonical install and execution directory:
~/.agents/skills/android-adb/
. Run commands from this directory:
bash
cd ~/.agents/skills/android-adb
One-off (safe in scripts/loops from any working directory):
bash
(cd ~/.agents/skills/android-adb && npx tsx scripts/adb_helpers.ts --help)
标准安装与执行目录:
~/.agents/skills/android-adb/
。请在此目录下运行命令:
bash
cd ~/.agents/skills/android-adb
一次性执行(可在任意工作目录的脚本/循环中安全使用):
bash
(cd ~/.agents/skills/android-adb && npx tsx scripts/adb_helpers.ts --help)

Core Capabilities

核心功能

  • Device discovery and connection management.
  • App lifecycle control (
    launch
    ,
    force-stop
    ).
  • Input primitives (
    tap
    ,
    swipe
    ,
    long-press
    ,
    keyevent
    ,
    text
    ).
  • Screenshot and UI dump utilities (
    screenshot
    ,
    dump-ui --parse
    ).
  • Install automation with UI assistance (
    install-smart
    ).
  • Device reset workflow for app (
    device-reset
    ).
  • 设备发现与连接管理
  • 应用生命周期控制(
    launch
    force-stop
  • 输入原语操作(
    tap
    swipe
    long-press
    keyevent
    text
  • 截图与UI导出工具(
    screenshot
    dump-ui --parse
  • 带UI辅助的安装自动化(
    install-smart
  • 应用专属设备重置流程(
    device-reset

Execution Constraints

执行约束

  • Use
    -s <device_id>
    whenever more than one device is connected.
  • Confirm resolution before coordinate actions:
    npx tsx scripts/adb_helpers.ts -s SERIAL wm-size
    .
  • Run each
    npx
    command in its owning skill directory (
    android-adb
    or
    ai-vision
    ).
  • Prefer helper subcommands before raw
    adb
    calls.
  • Prefer
    text --adb-keyboard
    when ADB Keyboard exists; otherwise use plain
    text
    .
  • Ask for missing required inputs before executing (serial, package/activity/schema, coordinates, APK path).
  • Surface actionable stderr on failure (authorization, cable/network, tcpip state, missing env vars).
  • 当连接多台设备时,务必使用
    -s <device_id>
    指定设备
  • 在执行坐标类操作前,请确认分辨率:
    npx tsx scripts/adb_helpers.ts -s SERIAL wm-size
  • 需在对应skill目录(
    android-adb
    ai-vision
    )中运行每个
    npx
    命令
  • 优先使用辅助子命令,而非直接调用原生
    adb
  • 若已安装ADB Keyboard,优先使用
    text --adb-keyboard
    ;否则使用普通
    text
    命令
  • 执行前需确认所有必填输入项(设备序列号、包名/活动名/架构、坐标、APK路径)是否齐全
  • 执行失败时需展示可操作的标准错误信息(权限问题、线缆/网络问题、tcpip状态、缺失环境变量)

Reference Map

参考文档

  • Command catalog and examples:
    references/adb-reference.md
  • Vision-first UI recognition flow:
    references/ui-recognition.md
  • Installer dialog handling details:
    references/install-smart.md
  • Generic verification handling:
    references/handle-verification.md
  • Device reset flow for app:
    references/device-reset.md
Load only the file needed for the current task.
  • 命令目录与示例:
    references/adb-reference.md
  • 视觉优先的UI识别流程:
    references/ui-recognition.md
  • 安装器弹窗处理细节:
    references/install-smart.md
  • 通用验证处理:
    references/handle-verification.md
  • 应用专属设备重置流程:
    references/device-reset.md
仅加载当前任务所需的文档即可。

Minimal Commands

基础命令示例

bash
npx tsx scripts/adb_helpers.ts --help
npx tsx scripts/adb_helpers.ts devices
npx tsx scripts/adb_helpers.ts -s SERIAL wm-size
npx tsx scripts/adb_helpers.ts -s SERIAL screenshot --out ~/.eval/screenshots/shot.png
bash
npx tsx scripts/adb_helpers.ts --help
npx tsx scripts/adb_helpers.ts devices
npx tsx scripts/adb_helpers.ts -s SERIAL wm-size
npx tsx scripts/adb_helpers.ts -s SERIAL screenshot --out ~/.eval/screenshots/shot.png