Skip to content
JordanSamhiPublic

About

An Android Instrumentation tool to compute Code Coverage

Resources

Stars

21 stars

Watchers

2 watching

Forks

Latest commit

 

History

122 Commits

Folders and files

Repository files navigation

AndroLog — Android execution analysis

AndroLog

Instrument Android apps. See what ran. Explore the code.

AndroLog adds logging probes to APKs and turns runtime logs into coverage statistics and dynamic call graphs. Choose automatic probes or place your own messages in the code. No application source code is needed.

Install · GUI walkthrough · Desktop guide · CLI guide · Wiki

Install and launch

To run from source, install:

  • JDK 17+ and Maven for the Java backend.
  • Node.js 22.12+ and npm for the desktop interface.
  • Android SDK with Platforms, Build Tools, and Platform Tools (adb).
git clone https://github.com/JordanSamhi/AndroLog.git
cd AndroLog
mvn package
cd electron-gui
npm ci
npm start

In Settings, choose your SDK's platforms folder and one build-tools/<version> folder. Java is detected automatically. For later launches, run npm start from electron-gui.

The Electron GUI targets macOS, Windows, and Linux. You can also build a desktop package with Java included.

Use AndroLog

1. Choose what to log

Open the original APK in Instrument. After selection, the logging options appear and the Coverage and Explore tabs become available. Select classes, methods, statements, Android components, or Dynamic call graph, then click Instrument APK. Save the result or test it directly on a connected device.

Click Reset to start a new session. This clears the current selections and report while keeping your saved files and SDK settings.

Instrument view: choose an APK, logging options, and a Logcat tag

Open Custom logging, browse the package → class → method tree, and select a statement:

Option What you choose What the report shows
Statement reached Just the statement; nothing to type. AndroLog adds an internal marker. Its location and Reached / Not reached status.
Custom message A string, such as starting checkout. Your message, its location, and whether it was reached.
Variable value Click Choose variable and select a local number, boolean, string, or object. Its location, whether it was reached, and the Latest value captured.

Click Use log points, then Instrument APK. Choose Custom only if you want these points without automatic coverage probes. Values are recorded before the selected statement; to inspect an assignment's result, select the following statement. Objects use their toString() representation.

Custom log editor with Statement reached, Custom message, and Variable value options, a package tree, and a selected integer variable

The code browser shows Jimple reconstructed from the APK. Messages and selected variable values are logged just before the chosen statement executes.

2. Test on a device

Click Test on device, choose a connected Android phone or emulator, and click Start test. AndroLog installs your instrumented APK, starts recording, and launches the app. Exercise it, then click Stop & analyze to open Coverage automatically. Enable USB debugging and authorize the computer when using a physical device.

If an existing app has a conflicting signing key, AndroLog offers to remove it and retry installation. Removing an app also deletes its data; you must confirm before AndroLog removes it.

Test on device recording an emulator run, with an elapsed timer and Stop & analyze button

Each test keeps the exact APK and its logs together. You can also use the commands under Run your app after saving, or the CLI's --capture option.

3. Read coverage

Stop & analyze opens the dashboard with your test's APK, logs, and tag already selected. It shows statements, methods, classes, and Android components observed during the run. For an existing capture, open its instrumented APK and log file in Coverage, enter the matching Logcat tag, and click Analyze run.

Coverage dashboard with observed totals and green percentage bars for statements, methods, classes, and Android components

Custom logs are grouped into Statement reached, Custom messages, and Variable values, with green Reached or red Not reached feedback. Variable logs also show the Latest value printed during the run. Click a row to jump to its statement in Explore. Red means not observed in this capture, not necessarily unreachable.

Results for all three custom logging options, with reached and unreached points and a captured integer value of 14

The instrumented APK and its logs are enough to analyze a run on another computer. No original APK or local instrumentation history is required. AndroLog's added code is excluded from the statistics.

4. Explore and share

Explore report lets you browse packages and methods, read whole classes with coverage highlighting, and follow code references. The dynamic call graph shows recorded calls; selecting a node highlights its incoming and outgoing edges.

Explore report showing a dynamic call graph with class navigation

Use Export HTML to share an interactive report that opens offline in a browser. Screenshots show a demonstration APK and its recorded execution on an Android emulator.

Command line

The same Java backend also supports instrumentation, automatic capture, and HTML/JSON reports:

java -jar target/androlog-0.1-jar-with-dependencies.jar --help

See the CLI guide for signing setup, examples, options, and coverage semantics. The desktop guide covers SDK setup, custom logs, packaging, and troubleshooting.

Contributing and license

AndroLog uses AndroSpecter and Soot for instrumentation and bytecode analysis. Issues and pull requests are welcome; see the development checks before submitting changes.

Licensed under LGPL v2.1. Contact: Jordan Samhi.

About

An Android Instrumentation tool to compute Code Coverage

Resources

Stars

21 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages