Closed sooraj-sizon-pj closed 8 months ago
Are you using nested virtualization or bare metal EC2 instance?
Is the setup wizard using animations? There's a known limitation of uiautomator
not being able to obtain screen dump when the device is not idle (i.e. animation).
To verifty that, if androidviewclient fails, you can try uiautomator dump
immediately and verify the same error is obtained.
To overcome that limitation and others and adding extra functionality is that CulebraTester2-public backend exists. Perhaps you can give it a try.
Are you using nested virtualization or bare metal EC2 instance? Is the setup wizard using animations?
I'm using EC2 bare metal instance (g4dn.metal)
There's a known limitation of
uiautomator
not being able to obtain screen dump when the device is not idle (i.e. animation). To verifty that, if androidviewclient fails, you can tryuiautomator dump
immediately and verify the same error is obtained.
To my surprise the same emulator build with setupwizard and everything works perfectly fine in my local machine running same ubuntu 22.04
To overcome that limitation and others and adding extra functionality is that CulebraTester2-public backend exists. Perhaps you can give it a try.
Thanks I will take a look ..
To test after the error you should run
adb shell uiautomator dump
You missed shell
in your screenshot.
https://source.android.com/docs/setup/create/cuttlefish perhaps this helps.
This was a bug in uiautomator for now simple workaround is add retries when this happens
MAX_RETRIES = 3
RETRY_DELAY = 1 # seconds
def retry_on_value_error(func):
@wraps(func)
def wrapper(*args, **kwargs):
retries = 0
while retries < MAX_RETRIES:
try:
return func(*args, **kwargs)
except ValueError as e:
print(f"Error: {e}, retrying... ({retries + 1}/{MAX_RETRIES})")
time.sleep(RETRY_DELAY)
retries += 1
raise ValueError(f"Failed after {MAX_RETRIES} retries")
return wrapper
viewClient.dump = retry_on_value_error(viewClient.dump)
Run this at the start of the script and every time uiautomnator sends empty xml it would retry
Interesting, I thought it wasn't a recoverable error. Great that retrying works.
Hi @dtmilano , I this error running AndroidViewClient on AWS ec2 instance
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.
I ran uiautomatorviewer dump which returned
Do you know what might cause this crash ?