title: Android instrumented unit test will not run on one physical device
body: <p>I have one device that throws an exception when I try to run unit tests on a project recently converted to use the androidX support libraries.  The tests have run on emulators and other physical devices.  </p>
  
  <p>The device it will not run on is a Pixel 2 running 9.</p>
  
  <p>App crashes with this exception:</p>
  
  <pre><code>AndroidRuntime: FATAL EXCEPTION: main
  AndroidRuntime: PID: 7050
  AndroidRuntime: java.lang.IllegalStateException: Call to getContentProviderExternal for: android_support_test_services.speak_easy returns null!
  AndroidRuntime:     at androidx.test.services.speakeasy.client.ToolConnection$ToolConnectionPostIcs.doCall(ToolConnection.java:155)
  AndroidRuntime:     at androidx.test.services.speakeasy.client.ToolConnection.publish(ToolConnection.java:93)
  AndroidRuntime:     at androidx.test.services.speakeasy.client.ToolConnection.publish(ToolConnection.java:83)
  AndroidRuntime:     at androidx.test.services.shellexecutor.BlockingPublish.getResult(BlockingPublish.java:79)
  AndroidRuntime:     at androidx.test.services.shellexecutor.ShellCommandExecutorServer.start(ShellCommandExecutorServer.java:80)
  AndroidRuntime:     at androidx.test.services.shellexecutor.ShellMain.main(ShellMain.java:45)
  AndroidRuntime:     at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
  AndroidRuntime:     at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
  AndroidRuntime: Error reporting crash
  AndroidRuntime: java.lang.RuntimeException: Bad file descriptor
  AndroidRuntime:     at android.os.BinderProxy.transactNative(Native Method)
  AndroidRuntime:     at android.os.BinderProxy.transact(Binder.java:1127)
  AndroidRuntime:     at android.app.IActivityManager$Stub$Proxy.handleApplicationCrash(IActivityManager.java:3711)
  AndroidRuntime:     at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:143)
  AndroidRuntime:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
  AndroidRuntime:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
  AndroidRuntime:     at java.lang.Thread.dispatchUncaughtException(Thread.java:1955)
  </code></pre>
  
  <p>Simplified Unit Test:</p>
  
  <pre><code>import androidx.test.rule.ActivityTestRule
  import org.junit.Assert
  import org.junit.Rule
  import org.junit.Test
  
  class MyTest {
  
      @Rule
      var activityTestRule: ActivityTestRule&lt;AuthAppActivity&gt; = object : ActivityTestRule&lt;AuthAppActivity&gt;(AuthAppActivity::class.java, false, false) {
          override fun afterActivityLaunched() {
          }
  
          override fun beforeActivityLaunched() {
          }
      }
  
      @Test
      fun runTest() {
  
          Assert.assertTrue(true);   // low standards here
      }
  }
  </code></pre>
  
  <p>And the relevant dependencies:</p>
  
  <pre><code>testImplementation('junit:junit:4.12') {
      exclude group: 'org.hamcrest', module: 'hamcrest-core'
  }
  testImplementation 'org.hamcrest:hamcrest-library:1.3'
  
  androidTestImplementation "androidx.annotation:annotation:1.0.0"
  
  androidTestImplementation "androidx.test:runner:1.1.0"
  androidTestImplementation "androidx.test:rules:1.1.0"
  
  androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
  
  androidTestImplementation "androidx.test.espresso:espresso-core:3.1.0"
  androidTestImplementation "androidx.test.espresso:espresso-idling-resource:3.1.0"
  androidTestImplementation "androidx.test.espresso:espresso-contrib:3.1.0"
  androidTestImplementation "androidx.test.espresso:espresso-web:3.1.0"
  androidTestImplementation "androidx.test.espresso:espresso-intents:3.1.0"
  </code></pre>