testing-samples: UiAutomator findObject is throwing IllegalStateException: UiAutomation not connected!
Getting below Exception for every consecutive execution
java.lang.IllegalStateException: UiAutomation not connected!
at android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:971)
at android.app.UiAutomation.waitForIdle(UiAutomation.java:577)
at android.support.test.uiautomator.UiAutomatorBridge.waitForIdle(UiAutomatorBridge.java:112)
at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:639)
at android.support.test.uiautomator.UiDevice.waitForIdle(UiDevice.java:629)
at android.support.test.uiautomator.UiDevice.getWindowRoots(UiDevice.java:1074)
at android.support.test.uiautomator.UiDevice.findObject(UiDevice.java:164)
observed throwing above exception immediately after executing below statement in logcat
W WindowManager: Attempted to remove non-existing token: android.os.Binder@2728fc2
Tested on API Level: 19, 21, 23 emulators, issue also replicating in real device Uiautomator Version: com.android.support.test.uiautomator:uiautomator-v18:2.1.2
Please let me know if you need any other information.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 8
- Comments: 26 (1 by maintainers)
Commits related to this issue
- Merge pull request #89 from xiphirx/support-api-23 Add support for API 23+ — committed to hannesa2/testing-samples by tdrhq 7 years ago
Why is there no way for UiAutomation to automatically reconnect on disconnect?
Also getting the exact same report, when submitting an app for Alpha Testing on the Play Store
I am also getting same issue, when running robo tests on Firebase Cloud test infrastructure.
Can you let us know the steps you followed to resolve the issue? “I solved this problem by putting my program in the background process and increasing the priority of the program.”
I am also getting same issue, When I test the android UI interface for a long time and need to sleep for a long time
When I test the android Q UI interface for a long time and need to sleep for a long time, I found that after a long sleep, my test program was killed by the android system, causing Uiautomator to not run normally.
I solved this problem by putting my program in the background process and increasing the priority of the program.
Same issue when submitting for Open Beta on the Play Store:
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:1970)
Even i faced the same issue …!
it fixed by doing adb kill-server , adb start-server .