AndroidViewClient icon indicating copy to clipboard operation
AndroidViewClient copied to clipboard

ValueError: received does not contain valid XML: Killed

Open g123k opened this issue 3 years ago • 1 comments

Hello,

When I try to dump the view hierarchy I have the following error. Any idea on how to fix it?

➜  ~ dump -x
Traceback (most recent call last):
  File "/Users/g123k/.pyenv/versions/3.10.4/lib/python3.10/site-packages/com/dtmilano/android/viewclient.py", line 3392, in __parseTreeFromUiAutomatorDump
    start_xml_index = receivedXml.index("<?xml")
ValueError: substring not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/g123k/.pyenv/versions/3.10.4/bin/dump", line 221, in <module>
    vc.dump(window=options[WINDOW])
  File "/Users/g123k/.pyenv/versions/3.10.4/lib/python3.10/site-packages/com/dtmilano/android/viewclient.py", line 3596, in dump
    self.setViewsFromUiAutomatorDump(received)
  File "/Users/g123k/.pyenv/versions/3.10.4/lib/python3.10/site-packages/com/dtmilano/android/viewclient.py", line 3178, in setViewsFromUiAutomatorDump
    self.__parseTreeFromUiAutomatorDump(received)
  File "/Users/g123k/.pyenv/versions/3.10.4/lib/python3.10/site-packages/com/dtmilano/android/viewclient.py", line 3395, in __parseTreeFromUiAutomatorDump
    raise ValueError("received does not contain valid XML: " + receivedXml)
ValueError: received does not contain valid XML: Killed

g123k avatar Sep 02 '22 11:09 g123k

It's due to a problem with uiautomator dump, which is producing and empty response (that's why <?xml is not found). You can try to manually invoke uiautomator dump in your situation to analyze the response, whether it's empty or an error message.

Using a different backend for AndroidViewClient would help. You can try https://github.com/dtmilano/CulebraTester2-public which works in many cases where uiautomator does not.

dtmilano avatar Sep 06 '22 18:09 dtmilano

Hi @dtmilano , I receive same error running AndroidViewClient on AWS ec2 instance Screenshot from 2023-10-31 13-07-36 I could not find uiautomatorin android sdk instead had to run uiautomatorviewer dump

Xlib extension RANDR missing on display :1

Do you know what might cause this issue ?

sooraj-sizon-pj avatar Oct 31 '23 10:10 sooraj-sizon-pj

@sooraj-sizon-pj you didn't describe what you are trying to achieve and how? what devices do you have connected to the EC2 instance and how? what's the output of adb devices ?

dtmilano avatar Nov 04 '23 05:11 dtmilano

The error shows the XML output was null.

dtmilano avatar Nov 04 '23 05:11 dtmilano

@sooraj-sizon-pj you didn't describe what you are trying to achieve and how? what devices do you have connected to the EC2 instance and how? what's the output of adb devices ?

Device is custom android emulator x86_64 running on AWS EC2 , I have same Emulator setup on my local env where AndroidViewClient works perfectly Where as on EC2 with same Automation script it goes through a few screens of android setupwizard and able to click on buttons and views and fails with this crash on like 4th or 5th step .

The emulator is running custom system-images build from AOSP A11_r1 tag has custom setup wizard another system app and a system service running very early at boot.

sooraj-sizon-pj avatar Nov 04 '23 15:11 sooraj-sizon-pj

@sooraj-sizon-pj please create another issue so we can track it properly. It's not exactly related to this one as several of the conditions are different.

dtmilano avatar Nov 06 '23 16:11 dtmilano

@sooraj-sizon-pj please create another issue so we can track it properly. It's not exactly related to this one as several of the conditions are different.

+1 created a new issue https://github.com/dtmilano/AndroidViewClient/issues/320

sooraj-sizon-pj avatar Nov 06 '23 18:11 sooraj-sizon-pj