Skip to content

Manual Workflow

Jordan Samhi edited this page Oct 23, 2026 · 1 revision

Use separate commands when you already have an Android test harness, need to trigger a non-launcher component, or want to parse an existing log.

First complete Installation. Set these variables in the same terminal as the androlog helper:

androlog_sdk="/absolute/path/to/Android/sdk"
androlog_apk="/absolute/path/to/app.apk"
androlog_package="com.example.app"

Replace com.example.app with the APK's application ID. It is used to restart the app, independently of any -pkg instrumentation filter.

1. Instrument the original APK

androlog \
  -a "$androlog_apk" -p "$androlog_sdk/platforms" \
  -o ./out/instrumented -l ANDROLOG \
  -c -m -s -cp -mc

The output APK keeps the input filename and is aligned and signed with the bundled test key. Keep the original APK for baseline generation. If you use -pkg or -n, repeat those options when reporting.

2. Install and collect logs

"$androlog_sdk/platform-tools/adb" install -r \
  "./out/instrumented/$(basename "$androlog_apk")"
"$androlog_sdk/platform-tools/adb" shell am force-stop "$androlog_package"
"$androlog_sdk/platform-tools/adb" logcat -c
"$androlog_sdk/platform-tools/adb" logcat -v threadtime ANDROLOG:D '*:S' \
  > ./out/runtime.log

Here, logcat -c intentionally clears the device's existing log buffers. Use Capture if you want an automatically bounded session without clearing those buffers.

Leave logcat running. Launch the app on the device and exercise it, or run your test harness from another terminal. Stop this manual logcat command with Ctrl+C when finished. Unlike Ctrl+C during --capture, this only ends the log collection step; run the reporting command next.

Start recording before launching a fresh process. Some coverage probes and call records are emitted only once per process. If several devices are attached, add -s <serial> immediately after adb in each command. If you change the tag with -l, change the logcat filter too.

3. Generate reports

androlog \
  -a "$androlog_apk" -p "$androlog_sdk/platforms" \
  -l ANDROLOG -c -m -s -cp -mc \
  -pa ./out/runtime.log \
  -html ./out/reports/coverage.html \
  -j ./out/reports/coverage.json

The APK argument must refer to the original APK, not the instrumented copy. AndroLog rebuilds its baseline and matches log payloads against it. Preserve the APK version, tag, probe flags, and scope between stages.

Replace -pa with -pam to include cumulative coverage by minute. Do not use both modes together. Omitting -html and -j produces terminal output only. Parent directories for report files are created automatically.

Graph-only workflow

Use -mc alone at both instrumentation and reporting stages if you only need a dynamic call graph. Adding it when parsing cannot reconstruct call events from an APK that was instrumented without it.

Reusing logs

You can regenerate reports without reinstalling the app or recapturing when the original APK and instrumentation options are unchanged. This does not add observations that were never recorded. An instrumentation change, a different APK version, or a different probe scope needs a new instrumented APK and fresh logs.

Read HTML Report or JSON and Logs for the outputs.

Clone this wiki locally