extracting-test-artifacts

Transfer files between host and Android device using adb pull, push, and run-as.

1|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill extracting-test-artifacts-citytexi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: extracting-test-artifacts
Source: https://github.com/citytexi/team-yg-pesonal-agent/tree/main/.claude/skills/extracting-test-artifacts
Command: npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill extracting-test-artifacts-citytexi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Moving test artifacts (screenshots, databases, JSON) between an Android device and a CI host fails in confusing ways: adb pull on /data/data/<pkg>/ returns "Permission denied", binary files get corrupted by PTY translation, and scoped storage on API 30+ changes which paths are writable. This Skill provides the exact path-permission rules and command patterns to make artifact transfer work reliably. ## Core Features & Use Cases - Path permission rules: A definitive table covering /data/local/tmp/, /sdcard/, /data/data/<pkg>/ (run-as only), and /sdcard/Android/data/<pkg>/files/ so you know which paths are pullable before writing CI scripts. - Binary-safe extraction: Uses adb exec-out run-as <pkg> cat and tar cf - | tar xf - pipelines to pull databases and directories without CRLF corruption. - Modern transfer flags: Covers -z brotli/lz4/zstd compression, --sync incremental pushes, and -a attribute preservation from platform-tools 30+. - TestStorage API: Wires androidx.test:services with useTestStorageService so per-test artifacts land automatically in Gradle's connected_android_test_additional_output/ directory. - Use Case: A screenshot-on-failure rule writes PNGs via Context.getExternalFilesDir(), and the CI script pulls them from /sdcard/Android/data/<pkg>/files/ without run-as, even on Android 11+. ## Quick Start Ask the assistant to pull a SQLite database from a debuggable app's private data directory using run-as and exec-out without corrupting the binary.

Frequently Asked Questions about extracting-test-artifacts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I pull files from /data/data/<pkg>/ with adb?▼

Use adb exec-out run-as <pkg> cat <path> on a debuggable build, since the shell user cannot traverse the app-owned 0700 directory. For directories, pipe tar through exec-out: adb exec-out run-as <pkg> tar cf - <dir> | tar xf -.

Why does adb pull fail with permission denied on /data/data?▼

The /data/data/<pkg>/ directory is owned by the app's UID with mode 0700, so the shell user backing adb cannot read it. Use run-as on debuggable builds or adb root on userdebug/eng builds.

How do I pull binary files from Android without corruption?▼

Use adb exec-out instead of adb shell, because adb shell allocates a PTY that translates LF to CRLF and corrupts binary content like SQLite databases. The command adb exec-out run-as <pkg> cat file.db > file.db keeps stdout binary-clean.

Can adb pull read /sdcard/Android/data/<pkg>/files/ on Android 11?▼

Yes. That directory is the app's external-private storage written via Context.getExternalFilesDir(), and adb shell retains read access through the FUSE/sdcardfs bridge even with scoped storage on API 30+.

What is the TestStorage API in androidx.test?▼

TestStorage is the modern artifact API from androidx.test:services, enabled with -e useTestStorageService true. Tests write via PlatformTestStorageRegistry, and Gradle's connectedAndroidTest automatically pulls outputs into connected_android_test_additional_output/.

When does run-as not work on Android?▼

run-as fails on release or non-debuggable builds with "Package is not debuggable", cannot switch to a system UID, and cannot cross profile boundaries without --user N. Verify android:debuggable="true" in the merged manifest first.