title: How to configure Android project for AndroidX Test
body: <p>I am having difficulty configuring my Android application for testing with AndroidX.</p>
  
  <p>When I attempt to run my initial test I get this error:-</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:processDebugAndroidTestManifest'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
     &gt; Could not resolve com.google.guava:listenablefuture:1.0.
       Required by:
           project :app
        &gt; Cannot find a version of 'com.google.guava:listenablefuture' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.0.1-android' --&gt; 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.espresso:espresso-contrib:3.1.1' --&gt; 'androidx.core:core:1.1.0-alpha05' --&gt; 'com.google.guava:listenablefuture:1.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.espresso:espresso-contrib:3.1.1' --&gt; 'androidx.core:core:1.1.0-alpha05' --&gt; 'androidx.concurrent:concurrent-futures:1.0.0-alpha02' --&gt; 'com.google.guava:listenablefuture:1.0'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
  
     &gt; Could not resolve com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava.
       Required by:
           project :app &gt; androidx.test.ext:truth:1.1.0 &gt; com.google.guava:guava:27.0.1-android
        &gt; Cannot find a version of 'com.google.guava:listenablefuture' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.0.1-android' --&gt; 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.espresso:espresso-contrib:3.1.1' --&gt; 'androidx.core:core:1.1.0-alpha05' --&gt; 'com.google.guava:listenablefuture:1.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.espresso:espresso-contrib:3.1.1' --&gt; 'androidx.core:core:1.1.0-alpha05' --&gt; 'androidx.concurrent:concurrent-futures:1.0.0-alpha02' --&gt; 'com.google.guava:listenablefuture:1.0'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
  
     &gt; Could not resolve com.google.guava:listenablefuture:1.0.
       Required by:
           project :app &gt; androidx.core:core:1.1.0-alpha05
           project :app &gt; androidx.concurrent:concurrent-futures:1.0.0-alpha02
        &gt; Cannot find a version of 'com.google.guava:listenablefuture' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.0.1-android' --&gt; 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.espresso:espresso-contrib:3.1.1' --&gt; 'androidx.core:core:1.1.0-alpha05' --&gt; 'com.google.guava:listenablefuture:1.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.espresso:espresso-contrib:3.1.1' --&gt; 'androidx.core:core:1.1.0-alpha05' --&gt; 'androidx.concurrent:concurrent-futures:1.0.0-alpha02' --&gt; 'com.google.guava:listenablefuture:1.0'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:listenablefuture' strictly '1.0' because of the following reason: debugRuntimeClasspath uses version 1.0
  
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 0s
  </code></pre>
  
  <p>My gradle resembles this:-</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  apply plugin: 'kotlin-android'
  
  apply plugin: 'kotlin-android-extensions'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId "com.research.jayunit"
          minSdkVersion 21
          targetSdkVersion 28
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
      buildToolsVersion '29.0.0 rc2'
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      useLibrary 'android.test.runner'
  
      useLibrary 'android.test.base'
      useLibrary 'android.test.mock'
  }
  
  dependencies {
      implementation fileTree(include: ['*.jar'], dir: 'libs')
  
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
      implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
      implementation 'androidx.core:core-ktx:1.1.0-alpha05'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
  
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
  
      // Core library
      androidTestImplementation 'androidx.test:core:1.1.0'
  
      // AndroidJUnitRunner and JUnit Rules
      androidTestImplementation 'androidx.test:runner:1.1.1'
      androidTestImplementation 'androidx.test:rules:1.1.1'
  
      // Assertions
      androidTestImplementation 'androidx.test.ext:junit:1.1.0'
      androidTestImplementation 'androidx.test.ext:truth:1.1.0'
      androidTestImplementation 'com.google.truth:truth:0.44'
  
      // Espresso dependencies
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.1'
      androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.1.1'
  
      // The following Espresso dependency can be either "implementation"
      // or "androidTestImplementation", depending on whether you want the
      // dependency to appear on your APK's compile classpath or the test APK
      // classpath.
      androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.1.1'
  }
  </code></pre>
  
  <p>The test I am attempting to execute resembles this:-</p>
  
  <pre><code>import android.content.Context
  import androidx.test.core.app.ApplicationProvider
  import androidx.test.ext.junit.runners.AndroidJUnit4
  import org.junit.Test
  import org.junit.runner.RunWith
  
  import org.junit.Assert.*
  
  /**
   * Instrumented test, which will execute on an Android device.
   *
   * See [testing documentation](http://d.android.com/tools/testing).
   */
  @RunWith(AndroidJUnit4::class)
  class ExampleInstrumentedTest {
      @Test
      fun useAppContext() {
          // Context of the app under test.
          val context = ApplicationProvider.getApplicationContext&lt;Context&gt;()
          assertEquals("com.research.jayunit", context.packageName)
      }
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>How can I resolve the gradle dependency issues?</p>
  
  <p>I've followed this <a href="https://developer.android.com/training/testing/set-up-project" rel="nofollow noreferrer">link</a> that show show to configure AndroidX for testing</p>
  
  <p>When I change my app gradle to include guava explicitly</p>
  
  <pre><code>   // https://mvnrepository.com/artifact/com.google.guava/guava
      implementation group: 'com.google.guava', name: 'guava', version: '27.1-android'
  </code></pre>
  
  <p>The dependency issues change to these below:-</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:preDebugAndroidTestBuild'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
     &gt; Could not resolve org.checkerframework:checker-compat-qual:2.5.2.
       Required by:
           project :app
        &gt; Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.truth:truth:0.44' --&gt; 'org.checkerframework:checker-compat-qual:2.5.5'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'org.checkerframework:checker-compat-qual:2.5.2'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'org.checkerframework:checker-compat-qual:2.5.2'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.truth:truth:0.44' --&gt; 'org.checkerframework:checker-compat-qual:2.5.5'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
  
     &gt; Could not resolve com.google.errorprone:error_prone_annotations:2.2.0.
       Required by:
           project :app
        &gt; Cannot find a version of 'com.google.errorprone:error_prone_annotations' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.truth:truth:0.44' --&gt; 'com.google.errorprone:error_prone_annotations:2.3.1'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'com.google.errorprone:error_prone_annotations:2.2.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'com.google.errorprone:error_prone_annotations:2.2.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.truth:truth:0.44' --&gt; 'com.google.errorprone:error_prone_annotations:2.3.1'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
  
     &gt; Could not resolve org.checkerframework:checker-compat-qual:2.5.5.
       Required by:
           project :app &gt; com.google.truth:truth:0.44
        &gt; Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.truth:truth:0.44' --&gt; 'org.checkerframework:checker-compat-qual:2.5.5'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'org.checkerframework:checker-compat-qual:2.5.2'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'org.checkerframework:checker-compat-qual:2.5.2'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.truth:truth:0.44' --&gt; 'org.checkerframework:checker-compat-qual:2.5.5'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
  
     &gt; Could not resolve com.google.errorprone:error_prone_annotations:2.3.1.
       Required by:
           project :app &gt; com.google.truth:truth:0.44
        &gt; Cannot find a version of 'com.google.errorprone:error_prone_annotations' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.truth:truth:0.44' --&gt; 'com.google.errorprone:error_prone_annotations:2.3.1'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'com.google.errorprone:error_prone_annotations:2.2.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'com.google.errorprone:error_prone_annotations:2.2.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.truth:truth:0.44' --&gt; 'com.google.errorprone:error_prone_annotations:2.3.1'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
  
     &gt; Could not resolve org.checkerframework:checker-compat-qual:2.5.2.
       Required by:
           project :app &gt; com.google.guava:guava:27.1-android
        &gt; Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.truth:truth:0.44' --&gt; 'org.checkerframework:checker-compat-qual:2.5.5'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'org.checkerframework:checker-compat-qual:2.5.2'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'org.checkerframework:checker-compat-qual:2.5.2'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.truth:truth:0.44' --&gt; 'org.checkerframework:checker-compat-qual:2.5.5'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
             Constraint path 'JayUnit:app:unspecified' --&gt; 'org.checkerframework:checker-compat-qual' strictly '2.5.2' because of the following reason: debugRuntimeClasspath uses version 2.5.2
  
     &gt; Could not resolve com.google.errorprone:error_prone_annotations:2.2.0.
       Required by:
           project :app &gt; com.google.guava:guava:27.1-android
        &gt; Cannot find a version of 'com.google.errorprone:error_prone_annotations' that satisfies the version constraints: 
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.truth:truth:0.44' --&gt; 'com.google.errorprone:error_prone_annotations:2.3.1'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'com.google.errorprone:error_prone_annotations:2.2.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.guava:guava:27.1-android' --&gt; 'com.google.errorprone:error_prone_annotations:2.2.0'
             Dependency path 'JayUnit:app:unspecified' --&gt; 'androidx.test.ext:truth:1.1.0' --&gt; 'com.google.truth:truth:0.44' --&gt; 'com.google.errorprone:error_prone_annotations:2.3.1'
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
             Constraint path 'JayUnit:app:unspecified' --&gt; 'com.google.errorprone:error_prone_annotations' strictly '2.2.0' because of the following reason: debugRuntimeClasspath uses version 2.2.0
  
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 1s
  </code></pre>