title: ApplicationTestCase deprecated in API level 24
body: <p>I created a default empty project on <strong>Android Studio 2.1.2</strong> with <strong>API 24</strong>. In the sample project, Google offers a depreciated class <strong><a href="https://developer.android.com/reference/android/test/ApplicationTestCase.html">ApplicationTestCase</a></strong>:</p>
  
  <blockquote>
    <p><strong>This class was deprecated in API level 24.</strong> Use ActivityTestRule
    instead. New tests should be written using the Android Testing Support
    Library.</p>
  </blockquote>
  
  <p><strong>Sample:</strong></p>
  
  <pre><code>import android.app.Application;
  import android.test.ApplicationTestCase;
  
  /**
   * &lt;a href="http://d.android.com/tools/testing/testing_android.html"&gt;Testing Fundamentals&lt;/a&gt;
   */
  public class ApplicationTest extends ApplicationTestCase&lt;Application&gt; {
      public ApplicationTest() {
          super(Application.class);
      }
  }
  </code></pre>
  
  <p><strong>My Question:</strong> Why Android Test Case is now deprecated? How to replace ApplicationTestCase by ActivityTestRule?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I try with <strong><a href="https://google.github.io/android-testing-support-library/downloads/index.html">Expresso</a></strong>, but on <strong>API 24</strong> (<code>compileSdkVersion 24</code>) I have this error:</p>
  
  <pre><code>Error:Conflict with dependency 'com.android.support:appcompat-v7'. Resolved versions for app (24.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
  Error:Conflict with dependency 'com.android.support:design'. Resolved versions for app (24.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
  Error:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (24.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
  Error:Conflict with dependency 'com.android.support:recyclerview-v7'. Resolved versions for app (24.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
  </code></pre>
  
  <p>When I try to add this lib in my build.gradle:</p>
  
  <pre><code>// Android JUnit Runner
  androidTestCompile 'com.android.support.test:runner:0.5'
  // JUnit4 Rules
  androidTestCompile 'com.android.support.test:rules:0.5'
  // Espresso core
  androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
  // Espresso-contrib for DatePicker, RecyclerView, Drawer actions, Accessibility checks, CountingIdlingResource
  androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
  // Espresso-web for WebView support
  androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.2'
  // Espresso-idling-resource for synchronization with background jobs
  androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
  </code></pre>
  
  <blockquote>
    <p><strong>My conclusion</strong> is that for the moment neither <strong>Android Test Case</strong> nor <strong>Expresso</strong> works on <strong>Android API 24</strong>. Is this right?</p>
  </blockquote>
  
  <hr>
  
  <p><strong>EDIT: 2016-08-05</strong></p>
  
  <p>I fix previous error on <strong>Expresso</strong> like that:</p>
  
  <pre><code>def espressoVersion = '2.2.2'
  def testRunnerVersion = '0.5'
  androidTestCompile "com.android.support.test:rules:${testRunnerVersion}"
  androidTestCompile "com.android.support.test.espresso:espresso-core:${espressoVersion}"
  configurations.androidTestCompile.dependencies.each { androidTestCompileDependency -&gt;
      androidTestCompileDependency.exclude group: 'com.android.support'
  }
  </code></pre>