Android Dependency Injection

0•

Structures robust Android dependency graphs and component lifecycles across Hilt, Dagger, Koin, and Metro to prevent memory leaks and runtime crashes.

The Android Dependency Injection skill guides Claude Code in architecting clean, maintainable object graphs across Android DI frameworks like Hilt, Dagger, Koin, and Metro. It enforces critical architectural boundaries by ensuring long-lived objects never reference short-lived Android components like Activities or Views, keeping bindings unscoped by default to avoid state leakage across tests, and prioritizing constructor injection over field injection. This skill helps developers catch graph wiring errors at compile time, eliminate circular dependencies, and safely manage runtime parameters with assisted injection.

Key Features

01Standardizes constructor injection and assisted injection patterns for runtime parameters
02Enforces strict lifetime hierarchy to prevent Activity and Context memory leaks
03Guides scope management by keeping bindings unscoped by default
04Detects wiring issues and missing bindings at compile time or via graph tests
050 GitHub stars
06Supports multi-framework DI standards across Hilt, Dagger, Koin, and Metro

Use Cases

01Refactoring Android ViewModels and repositories to eliminate memory leaks and circular dependencies
02Configuring new dependency injection modules and bindings in Hilt or Koin
03Setting up test-isolated dependency replacements without corrupting shared test suites