mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.79k stars 270 forks source link

[Bug] Failed to install apk UNAVAILABLE: io exception #587

Closed woen4 closed 1 year ago

woen4 commented 1 year ago

This error happens when in a android emulator or in a android real device, I run the flow:

appId: com.woendev.fleet
---
- launchApp
- tapOn: "http://10.0.2.2:8082"

I'm using React native 0.70.5 with Expo SDK 47

java.io.IOException: Failed to install apk /tmp/maestro-app107424638135617593.apk: Connection reset by peer
        at maestro.drivers.AndroidDriver.install(AndroidDriver.kt:487)
        at maestro.drivers.AndroidDriver.installMaestroApks(AndroidDriver.kt:467)
        at maestro.drivers.AndroidDriver.open(AndroidDriver.kt:82)
        at maestro.Maestro$Companion.android(Maestro.kt:508)
        at maestro.Maestro$Companion.android$default(Maestro.kt:501)
        at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:124)
        at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:36)
        at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:61)
        at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:60)
        at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:43)
        at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74)
        at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:60)
        at maestro.cli.command.TestCommand.call(TestCommand.kt:97)
        at maestro.cli.command.TestCommand.call(TestCommand.kt:39)
        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)

And try delete tmp files and the error was this below

io.grpc.StatusRuntimeException: UNAVAILABLE: io exception                                            
        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:376)
        at maestro.drivers.AndroidDriver.contentDescriptor(AndroidDriver.kt:252)                     
        at maestro.ViewHierarchy$Companion.from-c1iYVAs(ViewHierarchy.kt:28)                         
        at maestro.Maestro.viewHierarchy-prqvCes(Maestro.kt:313)                                     
        at maestro.Maestro.waitForAppToSettle-prqvCes(Maestro.kt:349)                                
        at maestro.Maestro.openLink(Maestro.kt:370)                                                  
        at maestro.orchestra.Orchestra.openLinkCommand(Orchestra.kt:484)                             
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:179)
        at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:138)
        at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:92)
        at maestro.cli.runner.MaestroCommandRunner.runCommands(MaestroCommandRunner.kt:120)
        at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:36)
        at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:32)
        at maestro.cli.runner.TestRunner.runCatching(TestRunner.kt:123)
        at maestro.cli.runner.TestRunner.runSingle(TestRunner.kt:32)
        at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:136)
        at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:97)
        at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:78)
        at maestro.cli.command.TestCommand.call(TestCommand.kt:97)
        at maestro.cli.command.TestCommand.call(TestCommand.kt:39)
        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:119)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:7001
Caused by: java.net.ConnectException: Connection refused
        at java.base/sun.nio.ch.Net.pollConnect(Native Method)
        at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
        at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
        at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:710)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

OS: Ubuntu 20.04.4 LTS maestro version: 1.18.5

axelniklasson commented 1 year ago

Hi @woen4, thanks for submitting an issue!

We recently released a guide on how to work with Maestro and React Native -- you can find it here and hopefully you can get going with the help of the guide!

On another note, your tapOn command is invalid -- tapping on a URL is not supported. You can read more about the tapOn command and view usage examples here.

Please feel free to reopen if this issue persists after going through the guide!

github-actions[bot] commented 3 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!