Repository navigation
Capture
--capture runs the complete instrumentation-to-report workflow. It is the simplest way to keep the original APK, probes, scope, and log tag consistent between stages.
The examples use the androlog helper and path variables from Installation and Quick Start.
androlog --capture \
-a "$androlog_apk" -p "$androlog_sdk/platforms" \
-o ./captures -l ANDROLOG \
-c -m -s -cp -mcThe CLI reports five stages:
| Stage | What happens |
|---|---|
| Prepare device and launcher | Find ADB, select a ready device, read the APK manifest |
| Instrument and sign APK | Insert selected probes, export, align, and sign the APK |
| Install APK | Run adb install -r on the selected device |
| Capture app execution | Restart the target app, record logs, and wait for Enter or a duration |
| Generate coverage reports | Rebuild the baseline from the original APK and write HTML/JSON |
The target app is force-stopped before capture so probes emitted once per process can be recorded again. Capture waits for a logcat readiness marker before launching, excludes older buffered records, and drains through a stop marker when you finish. It does not clear the device's log buffers.
"$androlog_sdk/platform-tools/adb" devices
androlog --capture --device emulator-5554 --duration 60 \
-a "$androlog_apk" -p "$androlog_sdk/platforms" \
-o ./captures -l ANDROLOG \
-c -m -s -cp -mcReplace emulator-5554 with a serial from your device list. --device is required when more than one device is ready. Offline and unauthorized devices are not selected.
The timer begins after launch completes. Launch-time observations are already included. Use a duration in scripts or any environment with closed standard input. Timed capture does not automatically exercise the UI; drive the app manually or with your own test tooling.
All probe options work with capture. For a graph-only run:
androlog --capture --duration 60 \
-a "$androlog_apk" -p "$androlog_sdk/platforms" \
-o ./captures -mcAdd -pkg com.example.app to restrict instrumentation to a package prefix, or -n to exclude known bundled libraries. These restrictions also affect what can be confirmed in the graph. The exact prefix matters for obfuscated applications; it is not necessarily the manifest's application ID.
-o is the parent of a fresh session directory, not the final report filename. Session names contain a UTC timestamp and a unique suffix. Files are listed in Quick Start.
Override report destinations when needed:
androlog --capture --duration 60 \
-a "$androlog_apk" -p "$androlog_sdk/platforms" \
-o ./captures -c -m -s -cp -mc \
-html ./reports/latest.html -j ./reports/latest.jsonExplicit report filenames can be overwritten by later runs; the session log and instrumented APK remain in their unique session directory. Capture generates a cumulative timeline automatically, using the same reporting mode as -pam.
Use --adb /absolute/path/to/adb to select an executable. Otherwise, AndroLog searches near the supplied SDK platform path, then ANDROID_HOME, ANDROID_SDK_ROOT, and PATH.
The launcher comes from a manifest intent filter containing MAIN and LAUNCHER, or LEANBACK_LAUNCHER for TV. Activity aliases are launched through the alias component; their target activity classes are used in graph metadata. With several launchers, capture uses the first sorted by target class and component name. An APK without a launcher needs the manual workflow and an appropriate way to trigger its components.
| Action or failure | Result |
|---|---|
| Press Enter | Stop capture, drain the log, generate HTML and JSON |
| Duration expires | Generate the same reports automatically |
| Press Ctrl+C | Abort, stop managed subprocesses, retain the partial raw log |
| Standard input closes without a duration | Fail with a message recommending --duration; retain the log |
| Device disconnects or logcat stops | Fail and retain the partial log |
| Installation has a signing mismatch | Report the failure; do not uninstall the app |
Recover a partial log using the original APK and the same probes, tag, and scope:
androlog \
-a "$androlog_apk" -p "$androlog_sdk/platforms" \
-l ANDROLOG -c -m -s -cp -mc \
-pam ./captures/SESSION/runtime.log \
-html ./reports/recovered.html -j ./reports/recovered.jsonReplace SESSION with the actual session directory. Check instrumentation.log or report-generation.log for child-process diagnostics. Add -v to forward detailed diagnostics to the terminal.
--capture cannot be combined with -pa or -pam. Its device, ADB, and duration options cannot be used in other modes.
Home · Quick Start · CLI Reference · Report an issue
AndroLog by Jordan Samhi · LGPL v2.1 · Documentation checked against 68b3312, 23 October 2026.
Start here
Understand your results
Reference