dadb icon indicating copy to clipboard operation
dadb copied to clipboard

Failed to run shell on marshmallow physical device

Open sav007 opened this issue 2 years ago • 8 comments

Running simple shell:

val dabd = Dadb.discover()
dabd.shell("echo test")

Fails on physical device 6.0 (Marshmallow):

Exception in thread "main" java.io.IOException: Command failed (shell,v2,raw:echo test): closed
	at dadb.adbserver.AdbServer.send$dadb(AdbServer.kt:99)
	at dadb.adbserver.AdbServerDadb.open(AdbServer.kt:138)
	at dadb.Dadb$DefaultImpls.openShell(Dadb.kt:43)
	at dadb.adbserver.AdbServerDadb.openShell(AdbServer.kt:118)
	at dadb.Dadb$DefaultImpls.shell(Dadb.kt:36)
	at dadb.adbserver.AdbServerDadb.shell(AdbServer.kt:118)

Android Debug Bridge version 1.0.41 Version 33.0.3-8952118

Any ideas why?

sav007 avatar Feb 08 '23 22:02 sav007

This actually makes Maestro test to fail run on Marshmallow devices.

sav007 avatar Feb 08 '23 22:02 sav007

Hey I believe this is due to a bug in the implementation of the base adb protocol. When I looked into this last, our experimental go implementation works on 6.0 devices while this kotlin implementation does not. I tried to fix a similar issue in this PR: https://github.com/mobile-dev-inc/dadb/pull/38/files but we ended up reverting due to it causing hangs in our cloud infra. We did not look further into this. I would start by looking into AdbStream to see if there are any discrepancies between this implementation and the go version (which I believe does still work on 6.0 devices.

Leland-Takamine avatar Feb 11 '23 20:02 Leland-Takamine

@Leland-Takamine the link to the go implementation is not accessible, private repo?

sav007 avatar Feb 13 '23 02:02 sav007

Are there plans to publish the go implementation? I'd like to look into this

NyCodeGHG avatar Oct 30 '23 11:10 NyCodeGHG

Would also like to look into this, if you can share a snippet of the connection.go code to go off please.

testifyqa avatar Oct 31 '23 19:10 testifyqa

ADB docs say API < 24 don't support the v2 shell protocol which is used by dadb.

https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/SERVICES.TXT#164

NyCodeGHG avatar Nov 13 '23 13:11 NyCodeGHG

Is this and Maestro still being actively worked on?

testifyqa avatar Nov 13 '23 17:11 testifyqa

maestro probably yes, this library seems a bit dead :/

NyCodeGHG avatar Nov 13 '23 18:11 NyCodeGHG