title: Android Studio showing unresolved reference in shared test directory, but executing tasks works as expected
body: <p>I have a multi-module app in which test source files are shared between modules. For each module that accesses the shared files, we add the following to our build.gradle</p>
  <pre><code>sourceSets {
      String testDir = '../shared/src/test/java'
      test {
          java.srcDir testDir
      }
  }
  </code></pre>
  <p>and add the shared module as a dependency using <code>implementation project(path: ':shared')</code></p>
  <p>When running tests using gradle everything works correctly, but when viewing the source files Android Studio is incorrectly showing Unresolved Reference errors.</p>
  <p>Oddly, one of our modules named &quot;feature&quot; doesn't exhibit this behaviour. All the other modules do though, despite them having identical build.gradle files.</p>
  <p>While investigating the issue I have noticed that when in the Project view the test directory in the shared module is labelled <code>[feature]</code> as if it belongs to the feature module.</p>
  <p>Furthermore, I have found the following in the Event Log:</p>
  <p><code>Duplicate content roots detected: Path [/project/shared/src/test/java] of module [project.feature was removed from modules [project.app, project.network project.wrapper]</code></p>
  <p>It's as if Android Studio is deliberately ignoring the sources.</p>
  <p>I have tried all combinations of resetting cache, deleting .idea and .gradle directories, cleaning etc. I have tried deleting and recreating the modules, and I can't find anything that's causing the issue.</p>
  <p>All team members are having the same issue.</p>
  <p>I can also see that the following appears in the <code>.idea/modules/feature/project.feature.iml</code> file, but not in any of the .iml files for the other modules.</p>
  <pre><code>&lt;content url=&quot;file://$MODULE_DIR$/../../../shared/src/test/java&quot;&gt;
      &lt;sourceFolder url=&quot;file://$MODULE_DIR$/../../../shared/src/test/java&quot; isTestSource=&quot;true&quot; /&gt;
  &lt;/content&gt;
  </code></pre>