Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist
Solution 1
The best way is to kill the adb server and start it again.
- sudo adb kill-server
- sudo adb start-server
This will do the trick.
Solution 2
Currently your UI needs to be idle (as in no Accessibility Events sent) for at least 1000ms before the AccessibilityService will be able to produce the UI hierarchy dump.
If you would try to run adb shell uiautomator dump
it would give you the ERROR: could not get idle state.
Solution 3
Even though it's late I'm giving my observation here. Even I got this issue. Before taking the screen shot from UI Automator terminate the appium server connection. Then try to capture screenshot. It works fine.
Solution 4
I realise this is an old post. But I've noticed the same issue when I've use uiautomator to control the simulator for automation testing. It seems that the uiautomatorviewer does not connect to the emulator to take a screenshot after the emulator has been controlled by the uiautomator.
I found that running adb reconnect
allows the uiautomatorviewer to take screenshots again.
Solution 5
Try Restarting your device, which worked in my case.
Related videos on Youtube
Ale7
Updated on February 24, 2022Comments
-
Ale7 over 2 years
I am testing my app with adb, but i get this error when i execute "dump view hierarchy for uiautomator":
Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
My adb version is 1.0.36 and my android version is 6.0.1.
This error comes launched only when in the interface there is a dynamic element that is in motion.
thank you in advance.
-
Ale7 over 7 yearsif i wanted to test an app not made by me but with the same problem? thank you in advance.
-
Alex P. over 7 yearsit's a limitation of the AccessibilityService itself. I am guessing that an app changing its UI more frequently than once per second is not considered accessible
-
Ale7 over 7 yearstherefore doesn't exist solution at this issue if i use adb? Thank you again.
-
ospider almost 7 yearsThat is correct, I have tried to restart my phone for several times, and It finally works
-
GhostCat almost 7 yearsReads more like a mediocre comment, not like an answer to the question.
-
bjones01001101 over 5 yearsThe commands worked for me, but I didn't need the
sudo
bit. -
Serg Buch over 5 yearsIn my case Appium server is not even running and I am still getting this error
-
LexSav about 4 yearsDon't forget to restart UIAutomator Viewer.
-
Stuart almost 4 yearstry
adb reconnect
. I've had the same issue. once the app is controlled via adb, it locks to that source.adb reconnect
unlocked it for uiautomatorviewer to gain control and take the screenshot. -
Mohsin Awan about 3 yearsSame. I've tried all but still facing the same issue!
-
Diego Torres Milano over 2 yearsglad to hear it works in your case. A simple test that can be run in that situations, to verify the difference, is the one described at github.com/dtmilano/CulebraTester2-public#androidviewclient; including or excluding
--use-uiautomator-helper
should show a successful dump or the error. Another advantage is that the dump could be in json.