maestro: [Android] Failed to install maestro-app.apk; IOException: Install failed

💡 Workaround

One possible workaround for this issue is to connect the device over Wi-Fi, which can help to mitigate the problem.

Document for connecting to a device over Wi-Fi


When I run maestro studio or maestro test, I encountered error: IOException: Install failed It works well in an emulator and another new real device.

What I have tried:

  1. Reboot Android device
  2. Reboot Macbook
  3. Uninstall dev.mobile.maestro by command: adb uninstall dev.mobile.maestro

Failure [DELETE_FAILED_INTERNAL_ERROR]

  1. Uninstall dev.mobile.maestro.test
  2. Install maestro-app.apk by adb install -r -d maestro-app.apk
  3. When I listed all packages in device, no maestro-related app were found.

adb shell pm list packages -f | grep maestro

kill -9 $(lsof -t -i tcp:7001)
kill -9 $(lsof -t -i tcp:9999)
  1. Deselect options in “Play Protect settings”

Environment

Android device:

Google Pixel 4 (Android 13)

macOS

Ventura 13.2 (Apple M1 Max)

maestro

  • 1.23.0
  • 1.26.1

Error logs

java.io.IOException: Failed to install apk /var/folders/87/xrrt4s0n3f585qj0n0twqk500000gp/T/maestro-app7643778700515813176.apk: Install failed: 
	at maestro.drivers.AndroidDriver.install(AndroidDriver.kt:552)
	at maestro.drivers.AndroidDriver.installMaestroApks(AndroidDriver.kt:532)
	at maestro.drivers.AndroidDriver.open(AndroidDriver.kt:85)
	at maestro.Maestro$Companion.android(Maestro.kt:538)
	at maestro.Maestro$Companion.android$default(Maestro.kt:531)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:151)
	at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:45)
	at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:80)
	at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:79)
	at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:37)
	at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:79)
	at maestro.cli.command.StudioCommand.call(StudioCommand.kt:36)
	at maestro.cli.command.StudioCommand.call(StudioCommand.kt:18)
	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:124)
Caused by: java.io.IOException: Install failed: 
	at dadb.Dadb$DefaultImpls.install(Dadb.kt:85)
	at dadb.adbserver.AdbServerDadb.install(AdbServer.kt:118)
	at maestro.drivers.AndroidDriver.install(AndroidDriver.kt:550)
	... 22 more

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 25
  • Comments: 17

Most upvoted comments

Below steps work for Pixel 4a. On your phone swipe down notification drawer > choose Use USB for option> Change this to File Transfer

Seems to be a USB issue, works if I connect the device via wireless debugging.

stuck at this! (macOS 12.5.1 )

Workaround: Run against an emulator, this appears to be an issue only with physical devices.

Other trace you might see if the APK is already installed:

Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/0:0:0:0:0:0:0:1:7001
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:777)

Note: I have the same error using a Pixel3a it runs fine with a Samsung Galaxy S8.