Open DavidREntwistle opened 1 year ago
@DavidREntwistle does this happen consistently or every now and then for you? What if you try different emulators / device models?
@axelniklasson it seems inconsistent across devices whilst running locally. But it looks to be consistently occurring when running on CI.
[Passed] test_flow29 (14s)
[Failed] test_flow30 (1m 29s) (Android driver unreachable)
[Failed] test_flow31 (41s) (Android driver unreachable)
Exception in thread "pool-4-thread-1" java.io.IOException: Command failed (host:transport:emulator-5554): device offline
at dadb.adbserver.AdbServer.send$dadb(AdbServer.kt:99)
at dadb.adbserver.AdbServerDadb.open(AdbServer.kt:137)
at dadb.forwarding.TcpForwarder.handleForwarding$lambda-1(TcpForwarder.kt:64)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
[Failed] test_flow32 (1m 20s) (Android driver unreachable)
[Failed] test_flow33 (1m 20s) (Android driver unreachable)
This looks related to this issue I raised here: https://github.com/mobile-dev-inc/maestro/issues/1525
It appears that now in v1.34.0 after this issue occurs, the flows continue to run with the "Android driver unreachable" message as the reason (this I feel is better).
I can't think of any reason why the device would go offline mid-execution.
Got it -- thanks for that context @DavidREntwistle. I would recommend running a separate process on your CI box that checks whether the device you're working with is online or not during the execution to rule out any environment specific issues. If it turns out that the device is online and functioning it does point towards a maestro issue, so let us know if that is the case. Thanks!
Thank you @axelniklasson I'll take a look at that from our side and feedback.
@axelniklasson I'm also facing the same issue after upgrading to Maestro 1.34.1. I've checked that emulator is running and responsive, yet maestro throws a "device offline" error and then all tests start failing with "Android driver unreachable".
I also checked maestro.log and found this:
[ERROR] maestro.drivers.AndroidDriver - Failed to get view hierarchy: Network closed for unknown reason
io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
at maestro_android.MaestroDriverGrpc$MaestroDriverBlockingStub.viewHierarchy(MaestroDriverGrpc.java:641)
at maestro.drivers.AndroidDriver.callViewHierarchy(AndroidDriver.kt:260)
at maestro.drivers.AndroidDriver.callViewHierarchy$default(AndroidDriver.kt:258)
at maestro.drivers.AndroidDriver.contentDescriptor(AndroidDriver.kt:249)
at maestro.ViewHierarchy$Companion.from-c1iYVAs(ViewHierarchy.kt:29)
at maestro.Maestro.viewHierarchy-prqvCes(Maestro.kt:412)
at maestro.Maestro$findElementWithTimeout$element$1.invoke(Maestro.kt:437)
at maestro.Maestro$findElementWithTimeout$element$1.invoke(Maestro.kt:436)
at maestro.utils.MaestroTimer.withTimeout(MaestroTimer.kt:16)
at maestro.Maestro.findElementWithTimeout(Maestro.kt:436)
at maestro.orchestra.Orchestra.findElement(Orchestra.kt:849)
at maestro.orchestra.Orchestra.evaluateCondition(Orchestra.kt:512)
at maestro.orchestra.Orchestra.evaluateCondition$default(Orchestra.kt:496)
at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:489)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:268)
at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:581)
at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:622)
at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:490)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:268)
at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:201)
at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:111)
at maestro.orchestra.Orchestra.runFlow$default(Orchestra.kt:75)
at maestro.cli.runner.TestSuiteInteractor.runFlow(TestSuiteInteractor.kt:210)
at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:69)
at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:152)
at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:136)
at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:101)
at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
at maestro.cli.command.TestCommand.call(TestCommand.kt:136)
at maestro.cli.command.TestCommand.call(TestCommand.kt:46)
at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
at picocli.CommandLine.access$1200(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
at picocli.CommandLine.execute(CommandLine.java:2058)
at maestro.cli.AppKt.main(App.kt:117)
I've experienced the Android driver unreachable
issue again whilst running the full flow suite of 69 flows.
Both the Android device & the app remained responsive during this time and didn't crash/close.
Looking into the maestro.log
file, when a similar view hierarchy
error occurs the following maestro command fails:
[ERROR] maestro.drivers.AndroidDriver - Timeout while fetching view hierarchy
[INFO ] m.cli.runner.TestSuiteInteractor - Tap on "${ACCOUNT}", id: ${output.home.switch.account} FAILED
Though the above "ERROR" was a maestro.drivers.AndroidDriver - Timeout while fetching view hierarchy
not the first reported maestro.drivers.AndroidDriver - Failed to get view hierarchy
.
Had a check within the commands json file for the flow when the error occurred, here is the below stack trace for the Android driver unreachable
error:
{"command":{"tapOnElement":{"selector":{"textRegex":"${ACCOUNT}","idRegex":"${output.home.switch.account}","optional":false},"retryIfNoChange":false,"waitUntilVisible":false,"longPress":false}},"metadata":{"status":"FAILED","timestamp":1701082911160,"duration":41455,"error":
{"stackTrace":[{"classLoaderName":"app","methodName":"callViewHierarchy","fileName":"AndroidDriver.kt","lineNumber":265,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"callViewHierarchy$default","fileName":"AndroidDriver.kt","lineNumber":258,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"contentDescriptor","fileName":"AndroidDriver.kt","lineNumber":249,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"from-c1iYVAs","fileName":"ViewHierarchy.kt","lineNumber":29,"nativeMethod":false,"className":"maestro.ViewHierarchy$Companion"},
{"classLoaderName":"app","methodName":"viewHierarchy-c1iYVAs","fileName":"ScreenshotUtils.kt","lineNumber":99,"nativeMethod":false,"className":"maestro.utils.ScreenshotUtils$Companion"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-OpTFbEc","fileName":"ScreenshotUtils.kt","lineNumber":58,"nativeMethod":false,"className":"maestro.utils.ScreenshotUtils$Companion"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-5RpGHs4","fileName":"AndroidDriver.kt","lineNumber":552,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-5RpGHs4","fileName":"Maestro.kt","lineNumber":457,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-5RpGHs4$default","fileName":"Maestro.kt","lineNumber":452,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"hierarchyBasedTap-hbl3e4M","fileName":"Maestro.kt","lineNumber":343,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"performTap-hbl3e4M","fileName":"Maestro.kt","lineNumber":271,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"tap-BUbHBYE","fileName":"Maestro.kt","lineNumber":185,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"tapOnElement","fileName":"Orchestra.kt","lineNumber":753,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeCommand","fileName":"Orchestra.kt","lineNumber":239,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeSubflowCommands","fileName":"Orchestra.kt","lineNumber":581,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runSubFlow","fileName":"Orchestra.kt","lineNumber":622,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlowCommand","fileName":"Orchestra.kt","lineNumber":490,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeCommand","fileName":"Orchestra.kt","lineNumber":268,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeCommands","fileName":"Orchestra.kt","lineNumber":201,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlow","fileName":"Orchestra.kt","lineNumber":103,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlow$default","fileName":"Orchestra.kt","lineNumber":75,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlow","fileName":"TestSuiteInteractor.kt","lineNumber":210,"nativeMethod":false,"className":"maestro.cli.runner.TestSuiteInteractor"},
{"classLoaderName":"app","methodName":"runTestSuite","fileName":"TestSuiteInteractor.kt","lineNumber":54,"nativeMethod":false,"className":"maestro.cli.runner.TestSuiteInteractor"},
{"classLoaderName":"app","methodName":"invoke","fileName":"TestCommand.kt","lineNumber":152,"nativeMethod":false,"className":"maestro.cli.command.TestCommand$call$1"},
{"classLoaderName":"app","methodName":"invoke","fileName":"TestCommand.kt","lineNumber":136,"nativeMethod":false,"className":"maestro.cli.command.TestCommand$call$1"},
{"classLoaderName":"app","methodName":"newSession","fileName":"MaestroSessionManager.kt","lineNumber":101,"nativeMethod":false,"className":"maestro.cli.session.MaestroSessionManager"},
{"classLoaderName":"app","methodName":"newSession$default","fileName":"MaestroSessionManager.kt","lineNumber":58,"nativeMethod":false,"className":"maestro.cli.session.MaestroSessionManager"},
{"classLoaderName":"app","methodName":"call","fileName":"TestCommand.kt","lineNumber":136,"nativeMethod":false,"className":"maestro.cli.command.TestCommand"},
{"classLoaderName":"app","methodName":"call","fileName":"TestCommand.kt","lineNumber":46,"nativeMethod":false,"className":"maestro.cli.command.TestCommand"},
{"classLoaderName":"app","methodName":"executeUserObject","fileName":"CommandLine.java","lineNumber":1933,"nativeMethod":false,"className":"picocli.CommandLine"},
{"classLoaderName":"app","methodName":"access$1200","fileName":"CommandLine.java","lineNumber":145,"nativeMethod":false,"className":"picocli.CommandLine"},
{"classLoaderName":"app","methodName":"executeUserObjectOfLastSubcommandWithSameParent","fileName":"CommandLine.java","lineNumber":2332,"nativeMethod":false,"className":"picocli.CommandLine$RunLast"},
{"classLoaderName":"app","methodName":"handle","fileName":"CommandLine.java","lineNumber":2326,"nativeMethod":false,"className":"picocli.CommandLine$RunLast"},
{"classLoaderName":"app","methodName":"handle","fileName":"CommandLine.java","lineNumber":2291,"nativeMethod":false,"className":"picocli.CommandLine$RunLast"},
{"classLoaderName":"app","methodName":"execute","fileName":"CommandLine.java","lineNumber":2159,"nativeMethod":false,"className":"picocli.CommandLine$AbstractParseResultHandler"},
{"classLoaderName":"app","methodName":"executionStrategy","fileName":"DisableAnsiMixin.kt","lineNumber":22,"nativeMethod":false,"className":"maestro.cli.DisableAnsiMixin$Companion"},
{"classLoaderName":"app","methodName":"execute","fileName":"CommandLine.java","lineNumber":2058,"nativeMethod":false,"className":"picocli.CommandLine"},
{"classLoaderName":"app","methodName":"main","fileName":"App.kt","lineNumber":117,"nativeMethod":false,"className":"maestro.cli.AppKt"}],
"message":"Android driver unreachable","localizedMessage":"Android driver unreachable"}}},
Followed by another Android driver unreachable
error:
{"assertConditionCommand":{"condition":{"visible":{"idRegex":"${output.tabBar.home}","optional":false}}}}],"sourceDescription":"../accountSwitch.yaml","config":{"appId":"com.test.android.demo"}}},"metadata":{"status":"FAILED","timestamp":1701082898057,"duration":86235,"error":
{"stackTrace":[{"classLoaderName":"app","methodName":"callViewHierarchy","fileName":"AndroidDriver.kt","lineNumber":265,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"callViewHierarchy$default","fileName":"AndroidDriver.kt","lineNumber":258,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"contentDescriptor","fileName":"AndroidDriver.kt","lineNumber":249,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"from-c1iYVAs","fileName":"ViewHierarchy.kt","lineNumber":29,"nativeMethod":false,"className":"maestro.ViewHierarchy$Companion"},
{"classLoaderName":"app","methodName":"viewHierarchy-c1iYVAs","fileName":"ScreenshotUtils.kt","lineNumber":99,"nativeMethod":false,"className":"maestro.utils.ScreenshotUtils$Companion"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-OpTFbEc","fileName":"ScreenshotUtils.kt","lineNumber":58,"nativeMethod":false,"className":"maestro.utils.ScreenshotUtils$Companion"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-5RpGHs4","fileName":"AndroidDriver.kt","lineNumber":552,"nativeMethod":false,"className":"maestro.drivers.AndroidDriver"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-5RpGHs4","fileName":"Maestro.kt","lineNumber":457,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"waitForAppToSettle-5RpGHs4$default","fileName":"Maestro.kt","lineNumber":452,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"hierarchyBasedTap-hbl3e4M","fileName":"Maestro.kt","lineNumber":343,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"performTap-hbl3e4M","fileName":"Maestro.kt","lineNumber":271,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"tap-BUbHBYE","fileName":"Maestro.kt","lineNumber":185,"nativeMethod":false,"className":"maestro.Maestro"},
{"classLoaderName":"app","methodName":"tapOnElement","fileName":"Orchestra.kt","lineNumber":753,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeCommand","fileName":"Orchestra.kt","lineNumber":239,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeSubflowCommands","fileName":"Orchestra.kt","lineNumber":581,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runSubFlow","fileName":"Orchestra.kt","lineNumber":622,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlowCommand","fileName":"Orchestra.kt","lineNumber":490,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeCommand","fileName":"Orchestra.kt","lineNumber":268,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"executeCommands","fileName":"Orchestra.kt","lineNumber":201,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlow","fileName":"Orchestra.kt","lineNumber":103,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlow$default","fileName":"Orchestra.kt","lineNumber":75,"nativeMethod":false,"className":"maestro.orchestra.Orchestra"},
{"classLoaderName":"app","methodName":"runFlow","fileName":"TestSuiteInteractor.kt","lineNumber":210,"nativeMethod":false,"className":"maestro.cli.runner.TestSuiteInteractor"},
{"classLoaderName":"app","methodName":"runTestSuite","fileName":"TestSuiteInteractor.kt","lineNumber":54,"nativeMethod":false,"className":"maestro.cli.runner.TestSuiteInteractor"},
{"classLoaderName":"app","methodName":"invoke","fileName":"TestCommand.kt","lineNumber":152,"nativeMethod":false,"className":"maestro.cli.command.TestCommand$call$1"},
{"classLoaderName":"app","methodName":"invoke","fileName":"TestCommand.kt","lineNumber":136,"nativeMethod":false,"className":"maestro.cli.command.TestCommand$call$1"},
{"classLoaderName":"app","methodName":"newSession","fileName":"MaestroSessionManager.kt","lineNumber":101,"nativeMethod":false,"className":"maestro.cli.session.MaestroSessionManager"},
{"classLoaderName":"app","methodName":"newSession$default","fileName":"MaestroSessionManager.kt","lineNumber":58,"nativeMethod":false,"className":"maestro.cli.session.MaestroSessionManager"},
{"classLoaderName":"app","methodName":"call","fileName":"TestCommand.kt","lineNumber":136,"nativeMethod":false,"className":"maestro.cli.command.TestCommand"},
{"classLoaderName":"app","methodName":"call","fileName":"TestCommand.kt","lineNumber":46,"nativeMethod":false,"className":"maestro.cli.command.TestCommand"},
{"classLoaderName":"app","methodName":"executeUserObject","fileName":"CommandLine.java","lineNumber":1933,"nativeMethod":false,"className":"picocli.CommandLine"},
{"classLoaderName":"app","methodName":"access$1200","fileName":"CommandLine.java","lineNumber":145,"nativeMethod":false,"className":"picocli.CommandLine"},
{"classLoaderName":"app","methodName":"executeUserObjectOfLastSubcommandWithSameParent","fileName":"CommandLine.java","lineNumber":2332,"nativeMethod":false,"className":"picocli.CommandLine$RunLast"},
{"classLoaderName":"app","methodName":"handle","fileName":"CommandLine.java","lineNumber":2326,"nativeMethod":false,"className":"picocli.CommandLine$RunLast"},
{"classLoaderName":"app","methodName":"handle","fileName":"CommandLine.java","lineNumber":2291,"nativeMethod":false,"className":"picocli.CommandLine$RunLast"},
{"classLoaderName":"app","methodName":"execute","fileName":"CommandLine.java","lineNumber":2159,"nativeMethod":false,"className":"picocli.CommandLine$AbstractParseResultHandler"},
{"classLoaderName":"app","methodName":"executionStrategy","fileName":"DisableAnsiMixin.kt","lineNumber":22,"nativeMethod":false,"className":"maestro.cli.DisableAnsiMixin$Companion"},
{"classLoaderName":"app","methodName":"execute","fileName":"CommandLine.java","lineNumber":2058,"nativeMethod":false,"className":"picocli.CommandLine"},
{"classLoaderName":"app","methodName":"main","fileName":"App.kt","lineNumber":117,"nativeMethod":false,"className":"maestro.cli.AppKt"}],
"message":"Android driver unreachable","localizedMessage":"Android driver unreachable"}}},
i have the same issue when running it locally for one flow , but its happening time to time not always
Experiencing this issue on Maestro v1.35.0 also.
[ERROR] maestro.drivers.AndroidDriver - Failed to get view hierarchy: Network closed for unknown reason
io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
at maestro_android.MaestroDriverGrpc$MaestroDriverBlockingStub.viewHierarchy(MaestroDriverGrpc.java:641)
at maestro.drivers.AndroidDriver.callViewHierarchy(AndroidDriver.kt:301)
at maestro.drivers.AndroidDriver.callViewHierarchy$default(AndroidDriver.kt:299)
at maestro.drivers.AndroidDriver.contentDescriptor(AndroidDriver.kt:265)
at maestro.ViewHierarchy$Companion.from-8JJjmZI(ViewHierarchy.kt:29)
at maestro.utils.ScreenshotUtils$Companion.viewHierarchy-c1iYVAs(ScreenshotUtils.kt:99)
at maestro.utils.ScreenshotUtils$Companion.waitForAppToSettle-OpTFbEc(ScreenshotUtils.kt:60)
at maestro.drivers.AndroidDriver.waitForAppToSettle-5RpGHs4(AndroidDriver.kt:605)
at maestro.Maestro.waitForAppToSettle-5RpGHs4(Maestro.kt:468)
at maestro.Maestro.waitForAppToSettle-5RpGHs4$default(Maestro.kt:463)
at maestro.Maestro.inputText(Maestro.kt:475)
at maestro.orchestra.Orchestra.inputTextCommand(Orchestra.kt:728)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:258)
at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:581)
at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:622)
at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:490)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:268)
at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:581)
at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:622)
at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:490)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:268)
at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:201)
at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:103)
at maestro.orchestra.Orchestra.runFlow$default(Orchestra.kt:75)
at maestro.cli.runner.TestSuiteInteractor.runFlow(TestSuiteInteractor.kt:210)
at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:69)
at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:152)
at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:136)
at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:101)
at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
at maestro.cli.command.TestCommand.call(TestCommand.kt:136)
at maestro.cli.command.TestCommand.call(TestCommand.kt:46)
at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
at picocli.CommandLine.access$1200(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
at picocli.CommandLine.execute(CommandLine.java:2058)
at maestro.cli.AppKt.main(App.kt:117)
[ERROR] maestro.drivers.AndroidDriver - Timeout while fetching view hierarchy
I've been able to simulate this issue here and I have left steps to replicate: https://github.com/mobile-dev-inc/maestro/issues/1525#issuecomment-1889192728
I'm wondering if this "Android driver unreachable whilst running flow" & the "Exception in thread "pool-4-thread-1"" issues I've raised could be related to something similar to this google issue raised.
If the device reconnects following the initial error, after 4 minutes the tests re-continue. cc. @axelniklasson
@axelniklasson Also hitting this issue on v1.35.0
Exception in thread "pool-4-thread-1" java.io.IOException: Command failed (host:transport:emulator-5554): device offline
at dadb.adbserver.AdbServer.send$dadb(AdbServer.kt:99)
at dadb.adbserver.AdbServerDadb.open(AdbServer.kt:137)
at dadb.forwarding.TcpForwarder.handleForwarding$lambda-1(TcpForwarder.kt:64)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Also encounter this issue on v1.35.0
@axelniklasson Also hitting this issue on v1.35.0
Exception in thread "pool-4-thread-1" java.io.IOException: Command failed (host:transport:emulator-5554): device offline at dadb.adbserver.AdbServer.send$dadb(AdbServer.kt:99) at dadb.adbserver.AdbServerDadb.open(AdbServer.kt:137) at dadb.forwarding.TcpForwarder.handleForwarding$lambda-1(TcpForwarder.kt:64) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)
Got the exact same issue running our flows
We are also facing the same issue when running on a macbook as a Azure local agent, Did anyone solve this please advice, Thankyou
@adithyaam I found one cause to be our ci agent timing out because of the long execution time/the timeout set to an hour when the flows took longer than an hour. Another reason was caused by the actual android emulator crashing, it seems some API versions are more stable than others.
The AccessibilityNodeInfo.getContentDescription()
NPE seems to be a bug in uiautomator that was fixed last year in 2.3.0-alpha04.
https://github.com/mobile-dev-inc/maestro/pull/1733 (not released yet) upgrades uiautomator to 2.3.0, so it should address this issue.
Wondering if there's a way to test snapshot builds of Maestro...
@dmitry-zaitsev Should a new version be released now that #1733 has been merged?
I'm on 1.38.1 and facing this issue as well using mac mini 2018, Sonoma 14.6
is there any confirmation if #1733 has already fixed this issue?
Based off the merge commit, the 'fix' has been in there since 1.37.0.
We've been experiencing this issue as well but on 1.36.0. Was interested in upgrading but if this issue still occurs for you on 1.38.1, doesn't bode well for us :'(
@iqbalmineraltown can you check if when you're running into it, there's a AccessibilityNodeInfo.getContentDescription
in the logs?
@robin-pham there is. Any idea ?
[INFO ] maestro.utils.ScreenshotUtils - Taking screenshot to output sink
[ERROR] maestro.drivers.AndroidDriver - Failed to get view hierarchy: Attempt to invoke virtual method 'java.lang.CharSequence android.view.accessibility.AccessibilityNodeInfo.getContentDescription()' on a null object reference
io.grpc.StatusRuntimeException: INTERNAL: Attempt to invoke virtual method 'java.lang.CharSequence android.view.accessibility.AccessibilityNodeInfo.getContentDescription()' on a null object reference
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
at maestro_android.MaestroDriverGrpc$MaestroDriverBlockingStub.viewHierarchy(MaestroDriverGrpc.java:641)
at maestro.drivers.AndroidDriver.callViewHierarchy(AndroidDriver.kt:329)
at maestro.drivers.AndroidDriver.callViewHierarchy$default(AndroidDriver.kt:327)
at maestro.drivers.AndroidDriver.contentDescriptor(AndroidDriver.kt:293)
at maestro.ViewHierarchy$Companion.from-8JJjmZI(ViewHierarchy.kt:29)
at maestro.utils.ScreenshotUtils$Companion.viewHierarchy-c1iYVAs(ScreenshotUtils.kt:99)
at maestro.utils.ScreenshotUtils$Companion.waitForAppToSettle-OpTFbEc(ScreenshotUtils.kt:58)
at maestro.drivers.AndroidDriver.waitForAppToSettle-5RpGHs4(AndroidDriver.kt:634)
at maestro.Maestro.waitForAppToSettle-5RpGHs4(Maestro.kt:477)
at maestro.Maestro.waitForAppToSettle-5RpGHs4$default(Maestro.kt:472)
at maestro.Maestro.hierarchyBasedTap-hbl3e4M(Maestro.kt:356)
at maestro.Maestro.performTap-hbl3e4M(Maestro.kt:284)
at maestro.Maestro.tap-BUbHBYE(Maestro.kt:198)
at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:845)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:243)
at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:673)
at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:714)
at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:582)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:275)
at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:191)
at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:127)
at maestro.cli.runner.TestSuiteInteractor.runFlow(TestSuiteInteractor.kt:250)
at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:82)
at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1$1.invoke(TestCommand.kt:281)
at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1$1.invoke(TestCommand.kt:258)
at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:102)
at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:54)
at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:258)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
[INFO ] maestro.Maestro - Something have changed in the UI judging by view hierarchy. Proceed.
as mentioned on https://github.com/mobile-dev-inc/maestro/issues/1573#issuecomment-1900179357 it runs well on Android emulator API level 32, but not on other API level supported by maestro
Has this not been fixed yet? Any workaround for this ?
Sadly this is still an issue and I haven't found a workaround @pntgoswami18
I'm having the same problem. I am also experiencing this with API Level 32. ref I have confirmed that it doesn't work with latest, but will it work if I downgrade?
I have increased my android emulator memory to 4GB and this seems to help this issue, by default it was at 2GB. I'm thinking the emulator/maestro driver crashed due to low memory usage. 4GB (4096) + seems more stable / less android driver unreachable errors occur.
Headless 4GB Emulator E.g.
${ANDROID_HOME}/emulator/emulator -memory 4096 -avd emulatorDeviceNameHere -camera-front emulated -camera-back emulated -gpu swiftshader_indirect -no-window -verbose -no-audio -show-kernel -read-only -no-boot-anim
ty @DavidREntwistle, we bumped it to 8192 and it's been much more stable ever since!
https://github.com/mobile-dev-inc/maestro/issues/1570#issuecomment-2425935936
It works, too! Thanks 🙏
Describe the bug Whilst running a flow that previously passed, the following error occurred:
UPDATE 27th November 2023: See post here.
To Reproduce Unable to reproduce at this moment.
Expected behavior To not fail getting the view hierarchy.
Screenshots
Environment information Maestro version [v1.34.0] Platform: [Android 13.0] Framework: [Native Android] Device model and OS version: [Pixel] Emulator device Host [Apple MacBook Pro M2 Max]
Additional context This was not an issue on v1.33.1 for Android. iOS v1.33.1 & v1.34.0 is not an issue.