I have to automate an Android application, I am doing the same through Appium. The problem I am facing is after launching the Appium server, the app is getting installed in the emulator 4.4.2 and to inspect the element I am using UIAutomatorviewer which comes default with SDK. But while inspecting the element of the app, I am getting the error![enter image description here][1]
Error obtaining UI hierarchy
Reason:Error while obtaining UI hierarchy XML file.com.android.ddmlb.SynchException.Remote object doesn't exist.
I tried to find the solution so that I can inspect the element so that I can script, but in vain.
- Can someone please tell how to fix the issue so that I can inspect elements?
- Is there any other way I can inspect element in the app apart from using UIAutomator viewer?
I had the same problem because I used "adbd insecure". So I just disabled "adbd insecure", and reload uiautomatorviewer, everything is OK.
This happens because adb is using port and it's blocked by appium server.
I have found out best solution for this
Kill the adb.exe from taskbar processes and try launching uiautomatorviewer again
try switching Off and then ON the USB debugging option.. this work for me
In case of rooted devices: Enable the root access in developer options for adb. Restart adb as root
What worked for me:
stop appium
open an emulator device (tested with Android 7.1.1)
go into settings > developer options > Enable view attribute inspection
open a shell on the computer, cmd or terminal depending on your OS
enter the following commands:
adb shell
su
cd /data
cd /local
chmod 777 tmp
start uiautomatorviewer
take an xml screenshot
"su chmod 777 /data/local/tmp" didnt work for me so I drilled down and it worked.
I assume that you have to do this in an emulator and not a physical device unless the device is rooted. ¯ \ _ (ツ)_/¯
Lotsa Luck!
we have to use device which has API level morethan 17 or jelly bean