How to resolve
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
Solution 2:
Try Restarting your device, which worked in some cases.
Solution 3:
run below command:
adb shell am force-stop com.android.ddmlib
If you find some other solution, please do the comment or contact us to revise this post.
it will help other readers to resolve the issues
Sometimes it could be resolved using Appium desktop usage instead of uiautomatorviewer
uiautomatorviewer sometimes causing issues
Appium desktop is the best tool to find out locators for android as well as iOS application