So I have this structure for my modules in my current app.
I haven\'t found any official documentation on multi-module navigation yet but I found this article r
It is possible to remove all Gradle inter-feature dependencies when you declare each feature nav graph ID explicitly in the base feature. I am not 100% satisfied with this solution since these IDs create "hidden" inter-feature dependencies but otherwise it works fine.
Here are the key parts of this setup:
:app
build.gradle
dependencies {
implementation project(':features:feature-base')
implementation project(':features:feature-one')
implementation project(':features:feature-two')
}
:features:feature-base
build.gradle
dependencies {
application project(':app')
feature project(':features:feature-one')
feature project(':features:feature-two')
}
navigation/feature_base_nav_graph.xml
values/feature_base_ids.xml
:features:feature-one
build.gradle
dependencies {
implementation project(':features:feature-base')
}
navigation/feature_one_nav_graph.xml
navigate
findNavController().navigate(R.id.navigateToFeatureTwo)
:features:feature-two
build.gradle
dependencies {
implementation project(':features:feature-base')
}
navigation/feature_two_nav_graph.xml
navigate
findNavController().navigate(R.id.navigateToFeatureOne)