问题
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.
回答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.
回答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.
回答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.
回答4:
Try Restarting your device, which worked in my case.
回答5:
Close other AccessibilityService in your phone please.
回答6:
Rebooting the device worked for me.
回答7:
in the device or emulator, display the applications opened , and close them all. monitor should refresh itself immediately, and get the hierarchies, as if one of the apps opened was making trouble.
回答8:
The below command executed from command line worked for me;
adb shell am force-stop com.android.ddmlib
回答9:
Before taking the screen shot from "uiautomatorviewer" please terminate the appium server connection by using ctrl+C command. Then try to capture screenshot. It works fine.
来源:https://stackoverflow.com/questions/40214342/error-obtaining-ui-hierarchy-error-while-obtaining-ui-hierarchy-xml-file-com-an