android / android/testing-samples

UiAutomator findObject is throwing IllegalStateException: UiAutomation not connected!

Open
#89 26 comments 9 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
9.3k
Forks
3.6k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start with the UiDevice.findObject stack trace and the preceding WindowManager logcat warning, then reproduce the failure on the listed API levels using UiAutomator 2.1.2. Done means the consecutive execution no longer produces the UiAutomation not connected exception, with the triggering conditions identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.