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. 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:
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.
UIAutomator
viewer?What is UiAutomatorViewer? “UIautomatorviewer” is a GUI tool to scan and analyze the UI components of an Android application.To automate any android application using Appium, a user needs to identify the objects in AUT (Application under test).
Open command prompt anywhere and enter command uiautomatorviewer. Note that there are no spaces in the command and it is just a single word. If you have configured the SDK properly, then you will get a UIAutomator window opened. Otherwise please check if the installation and configuration are done properly.
After my tryst with the uiautomator viewer i came to know that we get the error only when:
appium server is running and we try to capture the screenshot using uiautomatorviewer.
So, whenever you want to use uiautomatorviewer make sure that server is in stopped state.
I fixed the same issue by using following methods.
(1) Connect your Android device to your development machines;
(2) Go to command line in terminal or DOS command line for Windows;
(3) Using "adb shell" into your Android devices;
(4) Change the user to root by input "su root" in command line;
(5) Change the access right to /data/local/tmp by input "chmod 777 /data/local/tmp";
(6) Go back to uiautomatorviewer and do screen shot again, the error should be gone;
I guess there are some file can't be access if it doesn't own right in /data/local/tmp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With