Skip to content

Repository files navigation

Android Module Dependency Visualizer IntelliJ IDEA Plugin

License: MIT IntelliJ 2024.3+

An IntelliJ IDEA / Android Studio plugin that visualizes Android module dependency graphs as an interactive node diagram and analyzes them for unused or redundant dependencies.

Dependency Graph

The interactive dependency graph, shown on the bundled synthetic clean-architecture playground project.

Features

Visualization

  • Automatic dependency extraction — reads from the IntelliJ/Gradle project model, no manual configuration
  • Hierarchical layout — modules arranged by dependency depth with horizontal depth-ruler lines
  • Force-directed layout — Barnes-Hut optimized physics simulation as an alternative view
  • Smart module typing — auto-detects 12 module types from naming conventions (see table below)
  • App-scope filtering — select one or more app modules to show only their transitive dependency trees
  • Module type filtering — toggle module types on/off via color-coded chips in the sidebar
  • Configurable prefix exclusions — exclude module prefixes like build-logic or buildSrc
  • Color-coded dependency edges — green for outgoing, blue for incoming, red for wrong-direction (deeper → shallower), dashed red for unused
  • Interactive graph — pan (drag), zoom (scroll wheel or +/-), click to select, double-click to open build.gradle
  • Viewport culling — only renders visible nodes/edges for smooth performance on large projects
  • Legend overlay — shows module type colors for currently present types
  • Test module toggle — optionally show test, androidTest, and testFixtures source sets
  • Persistent settings — exclusion filters and test visibility saved per project

Dependency Analysis

  • Unused dependency detection — scans source files for imports, fully-qualified references, and resource/manifest references to determine if a dependency is actually used
  • Transitive redundancy detection — identifies dependencies that are already available transitively through a sibling module
  • Sibling api() exposure — detects when a dependency is transitively available via a sibling's api() configuration, marking it as truly redundant (high confidence)
  • Type leakage detection — checks if a sibling module's public API exposes types from the target dependency, which may mean the dependency is needed for compilation even without direct imports
  • DI/codegen awareness — lowers confidence for modules containing Dagger/Hilt, Room, or other infrastructure annotations that may be consumed via code generation rather than direct imports
  • Confidence scoring — each finding includes a confidence percentage based on package count, analysis type, and contextual signals
  • Reason display — every result shows a human-readable explanation of why it was flagged (visible in the analysis list, module detail panel, and markdown export)
  • Convention plugin filtering — dependencies injected by convention plugins (not explicitly declared in the module's build.gradle) are excluded from results
  • Markdown export — copy all results as formatted markdown with module grouping, confidence, and reasons

How the Analysis Works

The analyzer runs in two phases:

Phase 1 — Unused dependency detection: For each non-test dependency, the source module's files are scanned for references to the target module's packages:

  1. Import matching — checks if any import statement starts with a target package prefix
  2. FQN references — scans source code (with comments and strings stripped) for fully-qualified package references
  3. Resource/manifest references — checks AndroidManifest.xml and XML resource files for target package references
  4. DI/codegen heuristic — if no references are found but the target contains infrastructure annotations (@Module, @Provides, @Entity, etc.), confidence is lowered

Phase 2 — Transitive redundancy: For each dependency, checks whether the target module is already reachable through another direct dependency via api() (compile-scoped, exported) or implementation() (available at runtime but may break compilation if removed).

Post-processing — Sibling enrichment: Results are refined by checking sibling dependencies:

  • If a sibling exposes the target via api(), the dependency is marked as redundant with high confidence
  • If a sibling uses implementation() for the target, the analyzer checks for type leakage in the sibling's public API — if found, confidence is lowered since the dependency may be needed for compilation

Dependencies confirmed as used in Phase 1 are excluded from Phase 2 results, preventing false positives where a directly-used dependency also happens to be transitively available.

Installation

  1. Download the .zip file from Releases
  2. In Android Studio, go to Settings > Plugins > Gear icon > Install Plugin from Disk...
  3. Select the downloaded .zip file

Install Plugin

Building from Source

# Launch a sandboxed IDE with the plugin
./gradlew runIde

# Build the plugin zip
./gradlew buildPlugin

Playground

The playground/ directory contains four synthetic multi-module Gradle projects (≈110 fictional modules in total) for trying the plugin and reproducing issues without needing a real codebase:

Project Modules Shape
clean-architecture 49 Strict app → feature → domain → repository → data → core layering; every module type; multiple apps
feature-api-impl 22 Feature modules split into :feature-x-api / :feature-x-impl
mvvm-presentation 25 UI / presentation heavy, package-by-layer
legacy-monolith 12 One large app + unused dependencies — exercises Analyze

They are pure Kotlin/JVM, so they sync with only a JDK (no Android SDK). Open any of them in the sandbox IDE (./gradlew runIde), then open the Dependency Graph tool window. If you're filing a bug, pointing at the exact playground module/edge that misbehaves makes it easy to reproduce. See playground/README.md for details.

Selecting a module shows its dependencies/dependents The feature-api-impl architecture
Module detail panel feature-api-impl graph

Requirements

  • IntelliJ IDEA 2024.3+ or Android Studio based on 2024.3+
  • JDK 21+
  • An Android/Gradle project that has been synced (so the Gradle project model is available)

Usage

  1. Open an Android project in IntelliJ IDEA or Android Studio
  2. Make sure the Gradle project is synced
  3. Open the Dependency Graph tool window (bottom panel)
  4. The graph loads automatically — use the toolbar to refresh, fit to content, or switch layouts
  5. Click Analyze to scan for unused and redundant dependencies — results appear in the Analysis tab

Toolbar Actions

Action Description
Refresh Re-extract dependencies from the Gradle project model
Fit to Content Zoom and pan to show all nodes
Force Layout Toggle between hierarchical and force-directed layout
Analyze Scan for unused and transitive-redundant dependencies
Test Modules Show/hide test source set modules
Module Filters Configure excluded module prefixes

Keyboard Shortcuts

Key Action
Esc Deselect current module
F Fit graph to content
+ / = Zoom in
- Zoom out

Mouse Interactions

Action Effect
Click node Select/deselect module
Double-click node Open module's build.gradle in editor
Right-click node Context menu (select, navigate to build file)
Drag canvas Pan the view
Scroll wheel Zoom in/out at cursor position
Hover node Highlight with hand cursor

Module Types

Modules are auto-classified by name segments (split on :, -, _):

Type Color Detected Keywords
App Red Detected via com.android.application plugin or applicationId in build.gradle
Feature Teal feature, feat
Domain Blue domain, usecase, interactor
Core Salmon core, common, shared, base, foundation, platform, infrastructure
Repository Mint repository, repo
Library Plum library, lib, sdk, util, utils, helper, toolkit
Data Sky Blue data, database, db, storage, cache
UI Orange ui, compose, view, widget, presentation
Navigation Purple navigation, nav, routing, deeplink
DI Green di, inject, hilt, dagger, koin, wiring
Test Khaki Shown when test module toggle is enabled
Unknown Gray No keywords matched

Building

# Build the plugin
./gradlew build

# Run tests
./gradlew test

# Launch a sandboxed IDE with the plugin
./gradlew runIde

Contribution

Contributions are welcome! Please read the CLA carefully before submitting your contribution to Mercari. Under any circumstances, by submitting your contribution, you are deemed to accept and agree to be bound by the terms and conditions of the CLA.

https://www.mercari.com/cla/

Maintainers

Security

To report a security vulnerability, please follow the process in SECURITY.md. Do not open public issues for security reports.

License

This project is licensed under the MIT License.

Copyright (c) 2026 Mercari, Inc.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages