Managing Module Dependencies
Keep the graph clean and acyclic.
The Dependency Graph
Every module declares which other modules it depends on. Together these form a dependency graph. A healthy graph is a DAG (directed acyclic graph): dependencies point in one direction and never form a loop.
In this lesson you will learn how to declare dependencies cleanly, choose the right Gradle configuration, share versions, and prevent cycles.
Declaring a Module Dependency
You add a dependency on another module with project(":path:to:module") inside the dependencies block. The path mirrors the folders and matches what you declared in settings.gradle.kts.
// feature/profile/build.gradle.kts
dependencies {
implementation(project(":core:data"))
implementation(project(":core:designsystem"))
implementation(project(":core:model"))
}All lessons in this course
- Why Modularize
- Feature and Core Modules
- Managing Module Dependencies
- Navigation Across Modules