title: Android gradle src/androidTest/res/layout/mylayout.xml not found in mypackage.R
body: <p>I'm writing my unit tests using gradle in Android Studio. I have the tests located in:</p>
  
  <blockquote>
    <p>src/androidTest/java</p>
  </blockquote>
  
  <p>That works just fine. Now in my tests I want to access a resource that is defined in:</p>
  
  <blockquote>
    <p>src/androidTest/res</p>
  </blockquote>
  
  <p>Specifically, I want to get src/androidTest/res/layout/mylayout.xml. The problem is the R class for my test package or any package for that matter has mylayout defined.</p>
  
  <p>I did this on my build.gradle and it didn't make a difference:</p>
  
  <pre><code>sourceSets {
      androidTest.resources.srcDirs = ['src/res']
  }
  </code></pre>
  
  <p>How do I supply resources to androidTest classes that is only visible to the androidTest?</p>