title: Multi-module Navigation with Architecture Components
body: <p>So I have this structure for my modules in my current app.</p>
  
  <p><a href="https://i.stack.imgur.com/rNCdT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rNCdT.png" alt="App Module Structure"></a></p>
  
  <p>I haven't found any official documentation on multi-module navigation yet but I found this <a href="https://medium.com/@hartwich.daniel/multi-module-navigation-with-the-android-architecture-component-82ed028fa1d9" rel="noreferrer">article</a> regarding this so here's how my gradle files are:</p>
  
  <p><strong>Feature 1 - Detail</strong></p>
  
  <pre><code>...
  implementation project(":base")
  implementation project(":feature-2-detail")
  ...
  </code></pre>
  
  <p><strong>Feature 2 - Detail</strong></p>
  
  <pre><code>...
  implementation project(":base")
  implementation project(":feature-1-detail")
  ...
  </code></pre>
  
  <p><strong>Feature 3 - Detail</strong></p>
  
  <pre><code>...
  implementation project(":base")
  implementation project(":feature-1-detail")
  ...
  </code></pre>
  
  <p>And here are my navigation graphs:</p>
  
  <p><strong>Feature 1 - Detail</strong></p>
  
  <pre><code>&lt;navigation ...
      android:id="@+id/graph_feature_1_id"&gt;
      &lt;include app:graph="@navigation/graph_feature_2" /&gt;
      &lt;fragment ...
          android:id="@+id/nav_feature_1"&gt;
          &lt;action ...
              app:destination="@+id/graph_feature_2_id" /&gt;
  
      &lt;/fragment&gt;
  &lt;/navigation&gt;
  </code></pre>
  
  <p><strong>Feature 2 - Detail</strong></p>
  
  <pre><code>&lt;navigation ...
      android:id="@+id/graph_feature_2_id"&gt;
      &lt;include app:graph="@navigation/graph_feature_1" /&gt;
      &lt;fragment ...
          android:id="@+id/nav_feature_2"&gt;
          &lt;action ...
              app:destination="@+id/graph_feature_1_id" /&gt;
  
      &lt;/fragment&gt;
  &lt;/navigation&gt;
  </code></pre>
  
  <p><strong>Feature 3 - Detail</strong></p>
  
  <pre><code>&lt;navigation ...
      android:id="@+id/graph_feature_3_id"&gt;
      &lt;include app:graph="@navigation/graph_feature_1" /&gt;
      &lt;fragment ...
          android:id="@+id/nav_feature_3"&gt;
          &lt;action ...
              app:destination="@+id/graph_feature_1_id" /&gt;
  
      &lt;/fragment&gt;
  &lt;/navigation&gt;
  </code></pre>
  
  <p>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, <strong>Feature 1 - Detail</strong> can go to <strong>Feature 2 - Detail</strong> and vice versa and doing this gives me a circular dependency in gradle. </p>
  
  <p>Is there another way to do multi-module navigation? I've tried using deep links but to no avail. </p>
  
  <p>Any help would be appreciated! Thanks!</p>