title: What are the correct dependencies for Espresso tests?
body: <p>On different official Android sites there is different information on how to set up Espresso tests:</p>
  
  <p>1) <a href="https://developer.android.com/training/testing/ui-testing/espresso-testing" rel="nofollow noreferrer">https://developer.android.com/training/testing/ui-testing/espresso-testing</a></p>
  
  <pre class="lang-java prettyprint-override"><code>dependencies {
      // Other dependencies ...
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  }
  </code></pre>
  
  <p>2) <a href="https://developer.android.com/studio/test/" rel="nofollow noreferrer">https://developer.android.com/studio/test/</a></p>
  
  <pre class="lang-java prettyprint-override"><code>dependencies {
      // Required for local unit tests (JUnit 4 framework)
      testCompile 'junit:junit:4.12'
  
      // Required for instrumented tests
      androidTestCompile 'com.android.support:support-annotations:24.0.0'
      androidTestCompile 'com.android.support.test:runner:0.5'
  }
  </code></pre>
  
  <p>3) <a href="https://developer.android.com/training/testing/espresso/setup" rel="nofollow noreferrer">https://developer.android.com/training/testing/espresso/setup</a></p>
  
  <pre class="lang-java prettyprint-override"><code>androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test:rules:1.0.2'
  </code></pre>
  
  <ul>
  <li><p>With some configurations I get library conflicts ((2) explains that this is due to dependencies requiring the same other dependency but with different versions).</p>
  
  <ul>
  <li>Even excluding with </li>
  </ul>
  
  <p><code>androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2', {
      exclude group: 'com.android.support', module: 'support-annotations'
  }</code>
  might not help.</p></li>
  <li><p>With some configurations I get an error on the import of <code>android.support.test.rule.ActivityTestRule</code></p></li>
  </ul>