Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist

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.

like image 368
Ale7 Avatar asked Oct 24 '16 08:10

Ale7


4 Answers

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.

like image 95
Hitesh Grover Avatar answered Nov 14 '22 03:11

Hitesh Grover


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.

like image 18
Alex P. Avatar answered Nov 14 '22 01:11

Alex P.


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.

like image 11
snadella Avatar answered Nov 14 '22 01:11

snadella


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.

like image 9
Stuart Avatar answered Nov 14 '22 03:11

Stuart