maestro
maestro copied to clipboard
FileNotFoundException: .android\adbkey on Windows computer
Hi,
This tool look pretty nice, but I'm having some issues to make it work on my Windows 11 computer.
When I run the command from a PowerShell, I get the following exception:
> maestro --platform android test .\login-flow.yaml
java.io.FileNotFoundException: .android\adbkey (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
at dadb.AdbKeyPair$Companion.generate(AdbKeyPair.kt:103)
at dadb.AdbKeyPair$Companion.readDefault(AdbKeyPair.kt:77)
at dadb.Dadb$Companion.discover$default(Dadb.kt:196)
at maestro.cli.util.MaestroFactory.createAndroid(MaestroFactory.kt:50)
at maestro.cli.util.MaestroFactory.createMaestro(MaestroFactory.kt:35)
at maestro.cli.command.TestCommand.call(TestCommand.kt:58)
at maestro.cli.command.TestCommand.call(TestCommand.kt:30)
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 picocli.CommandLine.execute(CommandLine.java:2058)
at maestro.cli.AppKt.main(App.kt:74)
I'm using maestro 1.5.0.
Any input?
Do you have a ~/.android
folder on your machine?
I have same issue on my machine with Windows 10. adbkey stores at "C:\Users\{username}\.android" When I copied .android folder to "maestro-1.5.0\bin" folder, then i get other error:
maestro-1.5.0\bin> .\maestro -p android test flow.yaml java.lang.IllegalArgumentException: Illegal base64 character d at java.base/java.util.Base64$Decoder.decode0(Base64.java:746) at java.base/java.util.Base64$Decoder.decode(Base64.java:538) at java.base/java.util.Base64$Decoder.decode(Base64.java:561) at dadb.PKCS8.parse(PKCS8.kt:32) at dadb.AdbKeyPair$Companion.read(AdbKeyPair.kt:86) at dadb.AdbKeyPair$Companion.readDefault(AdbKeyPair.kt:80) at dadb.Dadb$Companion.discover$default(Dadb.kt:196) at maestro.cli.util.MaestroFactory.createAndroid(MaestroFactory.kt:50) at maestro.cli.util.MaestroFactory.createMaestro(MaestroFactory.kt:35) at maestro.cli.command.TestCommand.call(TestCommand.kt:58) at maestro.cli.command.TestCommand.call(TestCommand.kt:30) 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 picocli.CommandLine.execute(CommandLine.java:2058) at maestro.cli.AppKt.main(App.kt:74)
Do you have a
~/.android
folder on your machine?
Yes, I have it in C:\Users\myUsername
. And it has adbkey
file in it. It is the correct place to have it, right?
Hi, I too faced the same issue. It will be great if you could explain how to use the private adbkey .Thanks.
I found a workaround.
cd C:\Users\username\Downloads\maestro-1.5.0\maestro-1.5.0\bin
mkdir .android
.\maestro hierarchy
https://github.com/mobile-dev-inc/dadb/blob/ef3d30ed1b805debc8e5719b08f417568bd52c2a/dadb/src/main/kotlin/dadb/AdbKeyPair.kt#L73 It seems to look for .android in the current directory because HOME is not set by default.
I found a workaround.
cd C:\Users\username\Downloads\maestro-1.5.0\maestro-1.5.0\bin mkdir .android .\maestro hierarchy
https://github.com/mobile-dev-inc/dadb/blob/ef3d30ed1b805debc8e5719b08f417568bd52c2a/dadb/src/main/kotlin/dadb/AdbKeyPair.kt#L73 It seems to look for .android in the current directory because HOME is not set by default.
I have created the .android folder inside the maestro\bin folder but the issue was the same.
After I added the HOME
environment variable to C:\Users\myUsername
, which is were I have the .android
folder, but got the following error:
> maestro.bat --platform android test .\login-flow.yaml
java.lang.IllegalArgumentException: Illegal base64 character d
at java.base/java.util.Base64$Decoder.decode0(Base64.java:746)
at java.base/java.util.Base64$Decoder.decode(Base64.java:538)
at java.base/java.util.Base64$Decoder.decode(Base64.java:561)
at dadb.PKCS8.parse(PKCS8.kt:32)
at dadb.AdbKeyPair$Companion.read(AdbKeyPair.kt:86)
at dadb.AdbKeyPair$Companion.readDefault(AdbKeyPair.kt:80)
at dadb.Dadb$Companion.discover$default(Dadb.kt:196)
at maestro.cli.util.MaestroFactory.createAndroid(MaestroFactory.kt:50)
at maestro.cli.util.MaestroFactory.createMaestro(MaestroFactory.kt:35)
at maestro.cli.command.TestCommand.call(TestCommand.kt:58)
at maestro.cli.command.TestCommand.call(TestCommand.kt:30)
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 picocli.CommandLine.execute(CommandLine.java:2058)
at maestro.cli.AppKt.main(App.kt:74)
I found a workaround.
cd C:\Users\username\Downloads\maestro-1.5.0\maestro-1.5.0\bin mkdir .android .\maestro hierarchy
https://github.com/mobile-dev-inc/dadb/blob/ef3d30ed1b805debc8e5719b08f417568bd52c2a/dadb/src/main/kotlin/dadb/AdbKeyPair.kt#L73 It seems to look for .android in the current directory because HOME is not set by default.
I tried this, but now it just gets stuck after I run the command: maestro --platform android test flow.yaml
Perhaps the problem is the newline code of the adbkey file. dadb supports only LF. https://github.com/mobile-dev-inc/dadb/blob/ef3d30ed1b805debc8e5719b08f417568bd52c2a/dadb/src/main/kotlin/dadb/PKCS8.kt#L31 In Windows, the newline code is CRLF.
same issue using Windows10 : java.lang.IllegalArgumentException: Illegal base64 character d Workarounds:
- Convert C:\Users<your username>.android\adbkey from CRLF to LF
- Launching maestro using git bash If we launch pwershell or cmd we need to copy the .android\adbkey folder into the folder where we launch the maestro command.
by changing adbkey crlf to lf and by copying the files to .android under bin things move ahead. now the next error we see is 'View unix not available'
maestro --platform android test z.yaml java.lang.UnsupportedOperationException: View 'unix' not available at java.base/sun.nio.fs.AbstractFileSystemProvider.readAttributes(AbstractFileSystemProvider.java:93)
by changing adbkey crlf to lf and by copying the files to .android under bin things move ahead. now the next error we see is 'View unix not available'
maestro --platform android test z.yaml java.lang.UnsupportedOperationException: View 'unix' not available at java.base/sun.nio.fs.AbstractFileSystemProvider.readAttributes(AbstractFileSystemProvider.java:93)
I'm getting that error on Windows 11. On Windows 10 changing to LF works. Can anyone run maestro in Windows 11 and see why we are getting that unix error?
Faced the same error:
java.lang.IllegalArgumentException: Illegal base64 character d
I converted the adbkey
file, in my user directory (i.e. C:\Users\<User>\.android
), as suggested above to the UNIX way (LF) of ending lines (EOL), as opposed to the default on Windows (CR LF) using Notepad++ and I was able to run my tests successfully.
However, the steps in the VS Code console (powershell) are not updating (missing the green ticks?), even though the test is progressing successfully through them.
Windows Version: 10.0.19044 Build 19044
EDIT:
I noticed that I need to kill the app entirely on the emulator to get the test go through all of the test steps, otherwise it stops after launching the app
Hey @ampeixoto , this exception should be solved on the latest version of maestro 1.11.4. Let me know if this works for you now.
Also, we have included a proper guide on how to install maestro windows machine in case you are facing any difficulties:
https://maestro.mobile.dev/getting-started/installing-maestro/windows
Feel free to reopen if this still is an issue.
same issue using Windows10 : java.lang.IllegalArgumentException: Illegal base64 character d Workarounds:
- Convert C:\Users
.android\adbkey from CRLF to LF - Launching maestro using git bash If we launch pwershell or cmd we need to copy the .android\adbkey folder into the folder where we launch the maestro command.
I still had this issue today, with a fresh installed windows. This comment is the only one that fixed the problem. Thanks
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!