capturing-screenshots-and-screenrecord

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Capturing Screenshots and screenrecord — Visual Artefacts For Tests

捕获截图与 screenrecord — 用于测试的可视化制品

This skill covers grabbing PNG screenshots and MP4 screen recordings from a device through
adb
, plus the JUnit4 TestWatcher pattern for capturing on test failure. It does not cover Android Studio's screenshot tool, Compose
captureToImage()
, or third-party streaming tools (scrcpy/Vysor).
此 skill 介绍如何通过
adb
从设备获取 PNG 截图和 MP4 屏幕录制,以及如何使用 JUnit4 TestWatcher 模式在测试失败时捕获相关制品。它不涵盖 Android Studio 的截图工具、Compose
captureToImage()
或第三方流式工具(scrcpy/Vysor)。

When to use this skill

何时使用此 skill

  • A flaky CI test needs a screenshot at the moment of failure plus a logcat dump.
  • The team generates golden screenshots from a reference device for visual regression.
  • QA needs to record a 30 s repro of a bug for a bug report attachment.
  • The dev's
    adb shell screencap /sdcard/out.png
    produces a corrupt file — the missing
    -p
    flag wrote raw RGBA, not PNG.
  • A Windows CI agent receives screenshots with CRLF corruption — the fix is
    adb exec-out screencap -p
    .
  • 某个不稳定的 CI 测试需要在失败瞬间截取屏幕,并同时转储 logcat。
  • 团队从参考设备生成黄金截图,用于视觉回归。
  • QA 需要录制一段 30 秒的缺陷复现视频,作为缺陷报告附件。
  • 开发人员执行
    adb shell screencap /sdcard/out.png
    后生成了损坏文件——缺少
    -p
    标志会写入原始 RGBA 数据,而不是 PNG。
  • Windows CI 代理收到的截图存在 CRLF 损坏——修复方法是
    adb exec-out screencap -p
    。

When NOT to use this skill

何时不应使用此 skill

  • Compose-level screenshot tests using
    captureToImage()
    / Roborazzi / Paparazzi. Those are unit-test mechanisms and live under the Compose set, not ADB.
  • Continuous live mirroring of the device (presentations, demos). Use scrcpy or Vysor —
    screenrecord
    cannot stream.
  • Driving the device first (taps, key events). Use
    ../../control/injecting-input-and-state/SKILL.md
    .
  • Pulling files generally (not screenshots). Use
    ../../transfer/extracting-test-artifacts/SKILL.md
    .
  • 使用
    captureToImage()
    、Roborazzi 或 Paparazzi 的 Compose 级截图测试。这些是单元测试机制,属于 Compose 集合而非 ADB。
  • 持续实时镜像设备(展示、演示)。请使用 scrcpy 或 Vysor——
    screenrecord
    无法进行流式传输。
  • 驱动设备(点击、按键事件)。请使用
    ../../control/injecting-input-and-state/SKILL.md
    。
  • 常规文件拉取(不是截图)。请使用
    ../../transfer/extracting-test-artifacts/SKILL.md
    。

Prerequisites

前置条件

  • adb get-state
    returns
    device
    . See
    ../../devices/connecting-to-devices/SKILL.md
    .
  • For
    screenrecord
    : device API 19+ (Android 4.4) —
    screenrecord
    was added in KitKat.
  • For
    screenrecord
    + Wear OS: not supported. The utility refuses (developer.android.com/tools/adb#screenrecord).
  • For
    /sdcard/
    writes on API 30+: scoped-storage rules apply; the
    shell
    user retains FUSE/sdcardfs access, but app-private writes route through
    /sdcard/Android/data/<pkg>/
    .
  • adb get-state
    返回
    device
    。请参阅
    ../../devices/connecting-to-devices/SKILL.md
    。
  • 对于
    screenrecord
    :设备需为 API 19+(Android 4.4)——
    screenrecord
    是在 KitKat 中加入的。
  • screenrecord
    + Wear OS:不支持。该工具会拒绝执行(developer.android.com/tools/adb#screenrecord)。
  • 对于 API 30+ 上的
    /sdcard/
    写入:适用作用域存储规则;
    shell
    用户仍保留 FUSE/sdcardfs 访问权限,但应用私有写入需通过
    /sdcard/Android/data/<pkg>/
    路由。

screencap
— PNG screenshots

screencap
— PNG 截图

"The
screencap
command is a shell utility for taking a screenshot of a device display." — developer.android.com/tools/adb#screencap
screencap [-h] [-p] [-d <displayId>] [<path-on-device>]
FlagMeaning
(no flag)Writes raw RGBA framebuffer to file. Not a PNG.
-p
Encode as PNG. Required when streaming to stdout for the host.
-d <displayId>
Capture a specific logical display (multi-display devices).
-h
Help.
Three idiomatic invocations:
bash
undefined
“
screencap
命令是一个用于截取设备显示屏的 shell 工具。” — developer.android.com/tools/adb#screencap
screencap [-h] [-p] [-d <displayId>] [<path-on-device>]
标志含义
(无标志)将原始 RGBA 帧缓冲区写入文件。不是 PNG。
-p
编码为 PNG。流式传输到宿主机标准输出时必须使用。
-d <displayId>
捕获指定的逻辑显示屏(多显示屏设备)。
-h
帮助。
三种惯用调用方式:
bash
undefined

1. Save to device, then pull (good when the test continues running).

1. Save to device, then pull (good when the test continues running).

adb shell screencap -p /sdcard/screen.png adb pull /sdcard/screen.png ./screen.png
adb shell screencap -p /sdcard/screen.png adb pull /sdcard/screen.png ./screen.png

2. Stream PNG bytes back to host without an intermediate file.

2. Stream PNG bytes back to host without an intermediate file.

adb exec-out screencap -p > screen.png
adb exec-out screencap -p > screen.png

3. Multi-display capture: external display + main.

3. Multi-display capture: external display + main.

adb shell screencap -p -d 0 /sdcard/main.png adb shell screencap -p -d 1 /sdcard/external.png
undefined
adb shell screencap -p -d 0 /sdcard/main.png adb shell screencap -p -d 1 /sdcard/external.png
undefined

exec-out
vs
shell
— the binary-clean trap

exec-out
与
shell
对比——二进制安全陷阱

adb shell
sets up a PTY by default, which on some hosts (notably Windows) translates
\n
into
\r\n
on the way out. For binary streams (PNG, MP4, tar archives) this corrupts the file.
adb exec-out
is the binary-clean stdout variant.
Recipe — never use
adb shell screencap -p > out.png
for the streaming variant on Windows. Always:
bash
adb exec-out screencap -p > out.png
For files written on the device first and pulled afterwards, the issue does not apply (
adb pull
is binary-clean).
adb shell
默认会设置 PTY,在某些宿主机(尤其是 Windows)上可能在输出时将
\n
转换为
\r\n
。对于二进制流(PNG、MP4、tar 归档),这会损坏文件。
adb exec-out
是二进制安全的 stdout 变体。
命令模板——在 Windows 上进行流式捕获时,绝不要使用
adb shell screencap -p > out.png
。始终使用:
bash
adb exec-out screencap -p > out.png
对于先在设备上写入文件、随后再拉取的情况,此问题不适用(
adb pull
是二进制安全的)。

screenrecord
— MP4 screen recording

screenrecord
— MP4 屏幕录制

"The
screenrecord
command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file." — developer.android.com/tools/adb#screenrecord
screenrecord [--size WIDTHxHEIGHT] [--bit-rate RATE] [--time-limit TIME]
             [--rotate] [--bugreport] [--verbose] <path-on-device>
FlagVerbatim meaning (developer.android.com/tools/adb#screenrecord)
--help
"Display command syntax and options".
--size WxH
"Set the video size. The default value is the device's native display resolution (if supported), 1280x720 if not."
--bit-rate R
"Set the video bit rate for the video, in megabits per second. The default value is 20Mbps."
--time-limit T
"Set the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes)."
--rotate
"Rotate the output 90 degrees. This feature is experimental."
--bugreport
Embeds a textual frame info / timestamp overlay used by bug-report attachments.
--verbose
"Display log information on the command-line screen."
“
screenrecord
命令是一个 shell 工具,用于录制运行 Android 4.4(API 级别 19)及更高版本的设备的显示屏。该工具会将屏幕活动录制为 MPEG-4 文件。” — developer.android.com/tools/adb#screenrecord
screenrecord [--size WIDTHxHEIGHT] [--bit-rate RATE] [--time-limit TIME]
             [--rotate] [--bugreport] [--verbose] <path-on-device>
标志原文含义(developer.android.com/tools/adb#screenrecord)
--help
“显示命令语法和选项”。
--size WxH
“设置视频尺寸。默认值为设备的原生显示屏分辨率(如果支持),否则为 1280x720。”
--bit-rate R
“设置视频的比特率,单位为 Mbps。默认值为 20Mbps。”
--time-limit T
“设置最大录制时间,单位为秒。默认值和最大值为 180(3 分钟)。”
--rotate
“将输出旋转 90 度。此功能仍处于实验阶段。”
--bugreport
嵌入供缺陷报告附件使用的文本帧信息/时间戳叠加层。
--verbose
“在命令行屏幕上显示日志信息。”

Hard limits (verbatim)

硬性限制(原文)

  • "Audio is not recorded with the video file."
  • "Video recording is not available for devices running Wear OS."
  • "Some devices might not be able to record at their native display resolution. If you encounter problems with screen recording, try using a lower screen resolution."
  • "Rotation of the screen during recording is not supported."
  • The default and maximum time limit is 180 s. To capture longer scenarios, chain multiple invocations and concatenate post-hoc, or use scrcpy.
  • “视频文件不录制音频。”
  • “运行 Wear OS 的设备无法使用视频录制。”
  • “某些设备可能无法以其原生显示屏分辨率录制。如果遇到屏幕录制问题,请尝试使用更低的屏幕分辨率。”
  • “录制期间不支持屏幕旋转。”
  • 默认和最大时间限制均为 180 秒。要捕获更长的场景,请串联多次调用并在事后合并,或者使用 scrcpy。

No streaming flag — the limitation

不支持流式传输——该限制

screenrecord
writes a single MP4 to the device-side path; it does not stream to stdout. For live mirroring (presentations, demos), use scrcpy or Vysor (out of scope for this skill — both bypass
screenrecord
entirely).
screenrecord
会将单个 MP4 写入设备端路径;它不会流式传输到 stdout。对于实时镜像(展示、演示),请使用 scrcpy 或 Vysor(不在此 skill 的范围内——两者都完全绕过
screenrecord
)。

Output paths

输出路径

PathWhen
/sdcard/run.mp4
Default. User-visible video. Scoped-storage rules apply on API 30+ but
shell
user has FUSE/sdcardfs access.
/data/local/tmp/run.mp4
Use when the test app must produce output before the SD card is mounted, or to avoid touching the public store. Always pullable by
shell
.
路径使用时机
/sdcard/run.mp4
默认路径。用户可见视频。API 30+ 适用作用域存储规则,但
shell
用户拥有 FUSE/sdcardfs 访问权限。
/data/local/tmp/run.mp4
当测试应用必须在 SD 卡挂载前生成输出,或为避免写入公共存储区时使用。始终可由
shell
拉取。

Stopping early

提前停止

screenrecord
runs until
--time-limit
elapses or it receives SIGINT. From an interactive shell, Ctrl+C. From a script, send the signal to the on-device process:
bash
adb shell screenrecord --time-limit 180 /sdcard/run.mp4 &
REC=$!
screenrecord
会持续运行,直到
--time-limit
到期或收到 SIGINT。在交互式 shell 中,按 Ctrl+C。在脚本中,向设备端进程发送该信号:
bash
adb shell screenrecord --time-limit 180 /sdcard/run.mp4 &
REC=$!

… run instrumentation; on failure, send SIGINT to the on-device process …

… run instrumentation; on failure, send SIGINT to the on-device process …

adb shell pkill -INT screenrecord wait $REC adb pull /sdcard/run.mp4 ./run.mp4
undefined
adb shell pkill -INT screenrecord wait $REC adb pull /sdcard/run.mp4 ./run.mp4
undefined

--bugreport
overlay

--bugreport
叠加层

--bugreport
adds a frame-info + timestamp overlay to every frame, useful for QA repros where the bug-report-side timestamp must align with logcat. Pair with
adb logcat -v threadtime,year,UTC
to correlate frame numbers and log lines (see
../../observability/extracting-logs-with-logcat/SKILL.md
).
--bugreport
会为每一帧添加帧信息与时间戳叠加层,对于需要让缺陷报告侧时间戳与 logcat 对齐的 QA 复现很有用。请与
adb logcat -v threadtime,year,UTC
配合使用,以关联帧编号和日志行(请参阅
../../observability/extracting-logs-with-logcat/SKILL.md
)。

Capture-on-failure pattern (JUnit4 TestWatcher)

失败时捕获模式(JUnit4 TestWatcher)

The standard pattern: a
TestRule
or
TestWatcher
fires
failed()
on test failure, runs
screencap
+
logcat -d
, and pulls the artefacts to a per-test directory.
kotlin
class CaptureOnFailureRule(private val outputDir: File) : TestWatcher() {
    override fun failed(e: Throwable, description: Description) {
        val testName = "${description.className}.${description.methodName}"
        val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
        val target = File(outputDir, testName).apply { mkdirs() }

        // PNG screenshot
        device.executeShellCommand("screencap -p /sdcard/fail.png")
        device.executeShellCommand("logcat -d -v threadtime").let { log ->
            File(target, "logcat.txt").writeText(log)
        }
        // The test process can pull /sdcard/fail.png via Context.getExternalFilesDir
        // or push through TestStorageService — see ../../transfer/extracting-test-artifacts/SKILL.md.
    }
}
Host-side equivalent in a CI script (see
../../automation/scripting-adb-for-ci/SKILL.md
for the full version):
bash
set +e
./gradlew connectedDebugAndroidTest
RC=$?
set -e

if [ "$RC" -ne 0 ]; then
  mkdir -p artifacts
  adb shell screencap -p /sdcard/fail.png
  adb pull /sdcard/fail.png artifacts/fail.png
  adb logcat -d -v threadtime > artifacts/logcat.txt
  adb logcat -d -b crash      -v threadtime > artifacts/crash.txt
fi
exit $RC
This captures the device's last frame plus a logcat dump only on failure (saves CI storage on green runs). For richer per-test artefact routing, prefer the AndroidX TestStorageService API — see
../../transfer/extracting-test-artifacts/SKILL.md
.
标准模式:
TestRule
或
TestWatcher
会在测试失败时触发
failed()
,执行
screencap
+
logcat -d
,并将制品拉取到按测试划分的目录中。
kotlin
class CaptureOnFailureRule(private val outputDir: File) : TestWatcher() {
    override fun failed(e: Throwable, description: Description) {
        val testName = "${description.className}.${description.methodName}"
        val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
        val target = File(outputDir, testName).apply { mkdirs() }

        // PNG screenshot
        device.executeShellCommand("screencap -p /sdcard/fail.png")
        device.executeShellCommand("logcat -d -v threadtime").let { log ->
            File(target, "logcat.txt").writeText(log)
        }
        // The test process can pull /sdcard/fail.png via Context.getExternalFilesDir
        // or push through TestStorageService — see ../../transfer/extracting-test-artifacts/SKILL.md.
    }
}
CI 脚本中的宿主机端等效实现(完整版本请参阅
../../automation/scripting-adb-for-ci/SKILL.md
):
bash
set +e
./gradlew connectedDebugAndroidTest
RC=$?
set -e

if [ "$RC" -ne 0 ]; then
  mkdir -p artifacts
  adb shell screencap -p /sdcard/fail.png
  adb pull /sdcard/fail.png artifacts/fail.png
  adb logcat -d -v threadtime > artifacts/logcat.txt
  adb logcat -d -b crash      -v threadtime > artifacts/crash.txt
fi
exit $RC
这样只在失败时捕获设备最后一帧和 logcat 转储(CI 测试通过时不会浪费存储空间)。如需按测试更精细地路由制品,请优先使用 AndroidX TestStorageService API——请参阅
../../transfer/extracting-test-artifacts/SKILL.md
。

Patterns

模式

Pattern: WRONG —
screencap
without
-p

模式:错误——不带
-p
的
screencap

bash
undefined
bash
undefined

WRONG

WRONG

adb shell screencap /sdcard/out.png file /sdcard/out.png # → "data" (not a PNG)
adb shell screencap /sdcard/out.png file /sdcard/out.png # → "data" (not a PNG)

WRONG because: without -p, screencap writes a raw RGBA framebuffer (header + naked pixel

WRONG because: without -p, screencap writes a raw RGBA framebuffer (header + naked pixel

bytes), not a PNG. Image viewers refuse to open it. The .png extension is misleading.

bytes), not a PNG. Image viewers refuse to open it. The .png extension is misleading.


```bash

```bash

RIGHT

RIGHT

adb shell screencap -p /sdcard/out.png adb pull /sdcard/out.png ./out.png
undefined
adb shell screencap -p /sdcard/out.png adb pull /sdcard/out.png ./out.png
undefined

Pattern: WRONG —
adb shell screencap -p > out.png
on Windows

模式:错误——在 Windows 上使用
adb shell screencap -p > out.png

bash
undefined
bash
undefined

WRONG (on Windows / certain CI hosts)

WRONG (on Windows / certain CI hosts)

adb shell screencap -p > out.png
adb shell screencap -p > out.png

WRONG because:
adb shell
allocates a PTY and translates LF to CRLF on stdout. For

WRONG because:
adb shell
allocates a PTY and translates LF to CRLF on stdout. For

binary streams (PNG bytes) this corrupts the file.

binary streams (PNG bytes) this corrupts the file.


```bash

```bash

RIGHT (binary-clean stdout)

RIGHT (binary-clean stdout)

adb exec-out screencap -p > out.png
undefined
adb exec-out screencap -p > out.png
undefined

Pattern: long capture exceeds 3-minute cap

模式:长时间捕获超过 3 分钟上限

bash
undefined
bash
undefined

WRONG — assumes a single screenrecord can capture 10 minutes

WRONG — assumes a single screenrecord can capture 10 minutes

adb shell screenrecord --time-limit 600 /sdcard/run.mp4
adb shell screenrecord --time-limit 600 /sdcard/run.mp4

WRONG because: --time-limit is capped at 180. The utility silently truncates to 180.

WRONG because: --time-limit is capped at 180. The utility silently truncates to 180.


```bash

```bash

RIGHT — chain

RIGHT — chain

for i in 1 2 3 4; do adb shell screenrecord --time-limit 180 /sdcard/run-$i.mp4 done adb pull /sdcard/run-1.mp4 ./ adb pull /sdcard/run-2.mp4 ./ adb pull /sdcard/run-3.mp4 ./ adb pull /sdcard/run-4.mp4 ./
for i in 1 2 3 4; do adb shell screenrecord --time-limit 180 /sdcard/run-$i.mp4 done adb pull /sdcard/run-1.mp4 ./ adb pull /sdcard/run-2.mp4 ./ adb pull /sdcard/run-3.mp4 ./ adb pull /sdcard/run-4.mp4 ./

Concatenate with ffmpeg if needed:

Concatenate with ffmpeg if needed:

ffmpeg -f concat -i list.txt -c copy out.mp4

ffmpeg -f concat -i list.txt -c copy out.mp4


(Or switch to scrcpy for indefinite-duration captures.)

(或者改用 scrcpy 进行不限时长的捕获。)

Pattern: bug-report overlay for QA repros

模式:用于 QA 复现的缺陷报告叠加层

bash
adb shell screenrecord --bugreport --time-limit 60 \
  --bit-rate 8000000 --size 720x1280 /sdcard/repro.mp4
bash
adb shell screenrecord --bugreport --time-limit 60 \
  --bit-rate 8000000 --size 720x1280 /sdcard/repro.mp4

Each frame has a frame-info + timestamp overlay aligning with logcat -v threadtime,year,UTC.

Each frame has a frame-info + timestamp overlay aligning with logcat -v threadtime,year,UTC.

adb pull /sdcard/repro.mp4 ./repro.mp4 adb logcat -d -v threadtime,year,UTC > repro-logcat.txt
undefined
adb pull /sdcard/repro.mp4 ./repro.mp4 adb logcat -d -v threadtime,year,UTC > repro-logcat.txt
undefined

Mandatory rules

强制规则

  • MUST pass
    -p
    to
    screencap
    for PNG output. Without it, the file is raw RGBA and unusable in image viewers.
  • MUST prefer
    adb exec-out screencap -p > out.png
    over
    adb shell screencap -p > out.png
    for streaming captures, especially on Windows or any CI host where
    \n → \r\n
    translation may apply.
  • MUST treat
    screenrecord --time-limit
    as bounded by 180 s. Anything longer requires chaining or scrcpy.
  • MUST stop
    screenrecord
    with
    adb shell pkill -INT screenrecord
    (not
    kill -9
    from the host) — SIGKILL leaves the MP4 unfinalised and unplayable.
  • MUST NOT assume
    screenrecord
    captures audio — it does not (developer.android.com/tools/adb#screenrecord).
  • MUST NOT use
    screenrecord
    on Wear OS — unsupported.
  • PREFERRED: capture-on-failure only (not on every run). Saves CI storage and points at the failing test directly.
  • PREFERRED: pair every
    screenrecord --bugreport
    with a
    logcat -v threadtime,year,UTC
    dump captured at the same time. The overlay is otherwise hard to correlate.
  • 必须为
    screencap
    的 PNG 输出传入
    -p
    。否则文件为原始 RGBA 数据,图像查看器无法使用。
  • 必须在流式捕获时优先使用
    adb exec-out screencap -p > out.png
    ,而不是
    adb shell screencap -p > out.png
    ,尤其是在 Windows 或任何可能发生
    \n → \r\n
    转换的 CI 宿主机上。
  • 必须将
    screenrecord --time-limit
    视为最长 180 秒。超过该时长需要串联录制或使用 scrcpy。
  • 必须使用
    adb shell pkill -INT screenrecord
    停止
    screenrecord
    (不要从宿主机执行
    kill -9
    )——SIGKILL 会使 MP4 未能完成封装且无法播放。
  • 不得假设
    screenrecord
    会捕获音频——它不会捕获音频(developer.android.com/tools/adb#screenrecord)。
  • 不得在 Wear OS 上使用
    screenrecord
    ——不支持。
  • **首选:**仅在失败时捕获(而不是每次运行都捕获)。这可节省 CI 存储空间,并直接指向失败的测试。
  • **首选:**每次使用
    screenrecord --bugreport
    时,都应同时捕获
    logcat -v threadtime,year,UTC
    。否则叠加层很难与日志关联。

Verification

验证

  • file ./out.png
    reports
    PNG image data
    after
    adb shell screencap -p /sdcard/out.png && adb pull /sdcard/out.png
    .
  • On Windows CI, screenshots stream via
    adb exec-out screencap -p > out.png
    (no
    \r\n
    corruption).
  • CI captures
    screencap
    and
    logcat -d
    only when the test exit code is non-zero.
  • No
    screenrecord --time-limit <N>
    with
    N > 180
    exists in any script.
  • No
    kill -9
    on a
    screenrecord
    process — only
    pkill -INT screenrecord
    so the MP4 finalises.
  • CI artefact archive contains per-test sub-directories named after
    Class.method
    .
  • 在执行
    adb shell screencap -p /sdcard/out.png && adb pull /sdcard/out.png
    后,
    file ./out.png
    报告
    PNG image data
    。
  • 在 Windows CI 上,截图通过
    adb exec-out screencap -p > out.png
    流式传输(无
    \r\n
    损坏)。
  • CI 仅在测试退出码非零时捕获
    screencap
    和
    logcat -d
    。
  • 任何脚本中都不存在
    screenrecord --time-limit <N>
    且
    N > 180
    的情况。
  • 不对
    screenrecord
    进程使用
    kill -9
    ——仅使用
    pkill -INT screenrecord
    ,以确保 MP4 正常完成封装。
  • CI 制品归档包含以
    Class.method
    命名的按测试划分子目录。

References

参考资料

  • developer.android.com/tools/adb#screencap —
    screencap
    syntax,
    -p
    flag, exec-out streaming.
  • developer.android.com/tools/adb#screenrecord —
    screenrecord
    syntax, flags, hard limits ("Audio is not recorded", 180 s cap, no Wear OS, no rotation mid-recording).
  • developer.android.com/tools/adb#shellcommands — quoting + the
    exec-out
    vs
    shell
    distinction.
  • developer.android.com/training/testing/instrumented-tests/stability — screenshot/repro hygiene in instrumented tests.
  • Research note
    tasks/research/A2-adb-shell-commands.md
    — full
    screencap
    /
    screenrecord
    flag tables.
  • Research note
    tasks/research/A3-adb-observability-automation.md
    — capture-on-failure CI pattern;
    exec-out
    rationale.
  • Sibling skill:
    ../../architecture/understanding-adb-architecture/SKILL.md
    — server / daemon /
    adb shell
    vs
    adb exec-out
    .
  • Sibling skill:
    ../../devices/connecting-to-devices/SKILL.md
    —
    adb get-state
    , multi-device targeting.
  • Sibling skill:
    ../../devices/connecting-over-wifi/SKILL.md
    —
    adb pair
    for wireless capture.
  • Sibling skill:
    ../../apps/installing-and-managing-apps/SKILL.md
    — installing APKs to capture against.
  • Sibling skill:
    ../../tests/running-instrumented-tests-via-adb/SKILL.md
    —
    am instrument
    invocation.
  • Sibling skill:
    ../../control/injecting-input-and-state/SKILL.md
    — driving gestures before capturing.
  • Sibling skill:
    ../../observability/extracting-logs-with-logcat/SKILL.md
    — companion logcat capture in capture-on-failure.
  • Sibling skill:
    ../../transfer/extracting-test-artifacts/SKILL.md
    —
    adb pull
    and TestStorageService.
  • Sibling skill:
    ../../automation/scripting-adb-for-ci/SKILL.md
    — full CI capture-on-failure pattern.
  • Cross-set:
    ../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md
    — the JUnit4
    TestWatcher
    mechanic.
  • Cross-set:
    ../../../instrumentation/scenarios/launching-activities-with-activityscenario/SKILL.md
    — driving an Activity to the failing state before capture.
  • Cross-set:
    ../../../fundamentals/strategies/applying-testing-strategies/SKILL.md
    — when capture-on-failure beats screenshot-every-run.
  • developer.android.com/tools/adb#screencap —
    screencap
    语法、
    -p
    标志及 exec-out 流式传输。
  • developer.android.com/tools/adb#screenrecord —
    screenrecord
    语法、标志和硬性限制(“不录制音频”、180 秒上限、不支持 Wear OS、录制中途无法旋转)。
  • developer.android.com/tools/adb#shellcommands — 引号处理以及
    exec-out
    与
    shell
    的区别。
  • developer.android.com/training/testing/instrumented-tests/stability — 插桩测试中的截图/复现规范。
  • 研究笔记
    tasks/research/A2-adb-shell-commands.md
    — 完整的
    screencap
    /
    screenrecord
    标志表。
  • 研究笔记
    tasks/research/A3-adb-observability-automation.md
    — 失败时捕获的 CI 模式及
    exec-out
    原理。
  • 同级 skill:
    ../../architecture/understanding-adb-architecture/SKILL.md
    ——server / daemon 以及
    adb shell
    与
    adb exec-out
    的区别。
  • 同级 skill:
    ../../devices/connecting-to-devices/SKILL.md
    ——
    adb get-state
    和多设备定向。
  • 同级 skill:
    ../../devices/connecting-over-wifi/SKILL.md
    ——通过
    adb pair
    进行无线捕获。
  • 同级 skill:
    ../../apps/installing-and-managing-apps/SKILL.md
    ——安装 APK 以供捕获。
  • 同级 skill:
    ../../tests/running-instrumented-tests-via-adb/SKILL.md
    ——
    am instrument
    调用。
  • 同级 skill:
    ../../control/injecting-input-and-state/SKILL.md
    ——捕获前驱动设备执行手势操作。
  • 同级 skill:
    ../../observability/extracting-logs-with-logcat/SKILL.md
    ——失败时捕获配套使用的 logcat。
  • 同级 skill:
    ../../transfer/extracting-test-artifacts/SKILL.md
    ——
    adb pull
    和 TestStorageService。
  • 同级 skill:
    ../../automation/scripting-adb-for-ci/SKILL.md
    ——完整的 CI 失败时捕获模式。
  • 跨集合 skill:
    ../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md
    ——JUnit4
    TestWatcher
    机制。
  • 跨集合 skill:
    ../../../instrumentation/scenarios/launching-activities-with-activityscenario/SKILL.md
    ——在捕获前将 Activity 驱动至失败状态。
  • 跨集合 skill:
    ../../../fundamentals/strategies/applying-testing-strategies/SKILL.md
    ——何时采用失败时捕获而非每次运行都截图。