Google Fabric:UiAutomation未连接

将应用程序部署到Google Play Beta后,我在Crashlytics中看到了下一期(6 – 7位用户受到影响)

Fatal Exception: java.lang.IllegalStateException: UiAutomation not connected! at android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:971) at android.app.UiAutomation.disconnect(UiAutomation.java:237) at android.app.Instrumentation.finish(Instrumentation.java:222) at android.support.test.runner.MonitoringInstrumentation.finish(MonitoringInstrumentation.java:351) at android.support.test.runner.AndroidJUnitRunner.finish(AndroidJUnitRunner.java:405) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:394) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1960) 

它似乎是谷歌测试设备。 关于修复的任何想法?

似乎此崩溃与您的应用中的UI测试有关。 如果您没有任何UI测试,并且只有在创建项目期间自动添加的默认设置,您应该从build.gradle中删除defaultConfig中的testInstrumentationRunner行

  defaultConfig { .... testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } 

androidTestCompile,依赖的testCompile

 dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) testCompile 'junit:junit:4.12' ...