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 regarding this so here's how my gradle files are:
Feature 1 - Detail
...
implementation project(":base")
implementation project(":feature-2-detail")
...
Feature 2 - Detail
...
implementation project(":base")
implementation project(":feature-1-detail")
...
Feature 3 - Detail
...
implementation project(":base")
implementation project(":feature-1-detail")
...
And here are my navigation graphs:
Feature 1 - Detail
<navigation ...
android:id="@+id/graph_feature_1_id">
<include app:graph="@navigation/graph_feature_2" />
<fragment ...
android:id="@+id/nav_feature_1">
<action ...
app:destination="@+id/graph_feature_2_id" />
</fragment>
</navigation>
Feature 2 - Detail
<navigation ...
android:id="@+id/graph_feature_2_id">
<include app:graph="@navigation/graph_feature_1" />
<fragment ...
android:id="@+id/nav_feature_2">
<action ...
app:destination="@+id/graph_feature_1_id" />
</fragment>
</navigation>
Feature 3 - Detail
<navigation ...
android:id="@+id/graph_feature_3_id">
<include app:graph="@navigation/graph_feature_1" />
<fragment ...
android:id="@+id/nav_feature_3">
<action ...
app:destination="@+id/graph_feature_1_id" />
</fragment>
</navigation>
So everything works with this kind of setup but the problem here is that to connect the module to another module, we have to add the other feature as a dependency to the current feature. Like in my case, Feature 1 - Detail can go to Feature 2 - Detail and vice versa and doing this gives me a circular dependency in gradle.
Is there another way to do multi-module navigation? I've tried using deep links but to no avail.
Any help would be appreciated! Thanks!