Skip to content

运行时与设备

运行时与设备命令用于在编译部署之外读取当前 Jugg 状态、设备列表、Activity 栈和 App 日志窗口。它们常用于 Agent 判断下一步应编译、部署、等待日志还是先处理设备问题。

可完成的任务

用户任务当前支持情况命令
查看部署状态、未编译文件摘要和 AndroidTest baseline支持jugg status
列出已连接设备并标记 selected支持jugg devices
读取当前 Activity 栈支持jugg activity-stack
等待日志 marker、crash 或 timeout支持jugg wait-logs

状态查询

text
jugg status
jugg status --refresh-changes true

status 默认不刷新 changed files。需要让 Jugg 重新读取 git-tracked changed files 时传 --refresh-changes true

关键字段:

字段用途
hasDevice判断是否有可用设备
needFallback判断当前是否需要 Gradle 全量构建
pendingModifiedFiles / files查看未编译文件摘要
lastCompileTime判断当前修改是否已经被 Jugg 编译覆盖
hasBeenFullCompiled判断是否存在完整 Jugg 基线
enabledAndroidTest判断是否能走 instrument
isCompiling判断是否已有 compile/deploy 任务运行中

设备与 Activity

text
jugg devices
jugg activity-stack

devices 用于确认当前 IDE 侧可见设备和 selected 设备。activity-stack 用于确认目标 App 当前是否在预期页面,通常在 UI 检查或触控前使用。

日志等待

text
jugg wait-logs --marker '\[JUGG_AR\] DONE'
jugg wait-logs --marker '\[JUGG_AR\] DONE' --tags MyAutoRun,AndroidRuntime --timeout-ms 30000

wait-logs 会从最近一次 deployrestart 记录的时间点开始读取目标 App 日志,直到:

stopReason含义下一步
marker命中预期 marker读取返回的日志窗口判断验证结果
crash检测到 crash按失败处理并查看 crash 日志
timeout超时未命中 marker结果不确定,结合 UI 或完整日志继续判断

关联能力