我正在使用espresso和uiautomator在Android应用上进行一些测试。当我通过gitlab CI启动测试以通过wifi进行测试时,我总是会遇到这个问题:
java.lang.IllegalStateException: UiAutomation not connected!
at android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:1034)
at android.app.UiAutomation.waitForIdle(UiAutomation.java:638)
at android.support.test.uiautomator.QueryController.waitForIdle(QueryController.java:532)
at android.support.test.uiautomator.QueryController.waitForIdle(QueryController.java:523)
at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:621)
at android.support.test.uiautomator.UiDevice.pressBack(UiDevice.java:352)
at com.my.app.test.Steps.iPressBack(Steps.java:224)
at ✽.When I press Back(features/settings.feature:73)
问题是,当我在计算机上通过AndroidStudio在本地运行它们时,一切正常,并且在设备日志上,我也没有发现任何错误。我也尝试过不同的手机,但有相同的例外。