Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
109.2k stars 10.5k forks source link

Could not list ADB devices ,But I can use 'adb shell' normally #5001

Open C1heck0ut opened 3 months ago

C1heck0ut commented 3 months ago

Environment

Describe the bug When I use scrcpy, it reports an error ERROR: Could not list ADB devices ERROR: Server connection failed. I have deleted the windows environment variables. When I use the adb that comes with scrcpy, it returns List of devices attached HT68A0201096 device, and I can use adb shell to operate

C1heck0ut commented 3 months ago

It was working fine a few days ago.

Holdmyhand commented 2 months ago

Same issues here. image Previously used normally, may there have been issues with Win11 updates?

JaxonDozier7 commented 2 months ago

Try downloading scrcpy again.

Holdmyhand commented 2 months ago

Try downloading scrcpy again.

I used 2.4 before, and 2.5 in the picture was just downloaded

rom1v commented 2 months ago

@Holdmyhand I would need the raw output of adb devices -l. Could you please execute:

adb devices -l > output.txt

Then post the output.txt file (as a file).

Thank you.

@C1heck0ut Please post the output of adb devices -l.

Holdmyhand commented 2 months ago

@Holdmyhand I would need the raw output of adb devices -l. Could you please execute:

adb devices -l > output.txt

Then post the output.txt file (as a file).

Thank you.

@C1heck0ut Please post the output of adb devices -l.

OK,I executed this command, but it seems that the output.txt I received is empty.

Microsoft Windows [版本 10.0.22621.3737]
(c) Microsoft Corporation。保留所有权利。

D:\scrcpy-win64-v2.5>adb devices -l
List of devices attached
a1d918ec               device product:raphael model:Redmi_K20_Pro_Premium_Edition device:raphael transport_id:1

D:\scrcpy-win64-v2.5>adb devices -l > output.txt

D:\scrcpy-win64-v2.5>type output.txt

D:\scrcpy-win64-v2.5>adb devices -l >> output.txt

D:\scrcpy-win64-v2.5>type output.txt

D:\scrcpy-win64-v2.5>adb version
Android Debug Bridge version 1.0.41
Version 35.0.0-11411520
Installed as D:\scrcpy-win64-v2.5\adb.exe
Running on Windows 10.0.22621

D:\scrcpy-win64-v2.5>

image

rom1v commented 2 months ago

I executed this command, but it seems that the output.txt I received is empty.

OK, that's the problem then: when its output is captured, it produces no output (so when scrcpy executes adb devices -l, it receives nothing).

I could not reproduce, adb devices -l > output.txt always writes the output to output.txt.

Since the official adb.exe (which is provided in the scrcpy release) does not behave that way, I think something on your system messed it up (maybe some antivirus or other buggy "security" tool?)

Just to be sure, check that your binaries are correct:

certUtil -hashfile adb.exe SHA256
certUtil -hashfile AdbWinApi.dll SHA256
certUtil -hashfile AdbWinUsbApi.dll SHA256

Here are the expected sha256sums for the v2.5 release:

997324a38d89e3b282306bf25ccaa167c49a35850ac0ab4a169e7a15afa82fc8  adb.exe
1ad523231de449af3ba0e8664d3af332f0c5cc4f09141691ca05e35368fa811a  AdbWinApi.dll
51a61758a6f1f13dd36530199c0d65e227cd9d43765372b2942944cc3296ca2c  AdbWinUsbApi.dll
rom1v commented 2 months ago

Does echo "hello" > output.txt work?

Related: https://exiftool.org/forum/index.php?topic=5848.0

Holdmyhand commented 2 months ago

Does echo "hello" > output.txt works? 

Related: https://exiftool.org/forum/index.php?topic=5848.0

I have verified and compared these files, and the hash value is correct. Use echo works fine.

Microsoft Windows [版本 10.0.22621.3737]
(c) Microsoft Corporation。保留所有权利。

D:\scrcpy-win64-v2.5>certUtil -hashfile adb.exe SHA256
SHA256 的 adb.exe 哈希:
997324a38d89e3b282306bf25ccaa167c49a35850ac0ab4a169e7a15afa82fc8
CertUtil: -hashfile 命令成功完成。

D:\scrcpy-win64-v2.5>certUtil -hashfile AdbWinApi.dll SHA256
SHA256 的 AdbWinApi.dll 哈希:
1ad523231de449af3ba0e8664d3af332f0c5cc4f09141691ca05e35368fa811a
CertUtil: -hashfile 命令成功完成。

D:\scrcpy-win64-v2.5>certUtil -hashfile AdbWinUsbApi.dll SHA256
SHA256 的 AdbWinUsbApi.dll 哈希:
51a61758a6f1f13dd36530199c0d65e227cd9d43765372b2942944cc3296ca2c
CertUtil: -hashfile 命令成功完成。

D:\scrcpy-win64-v2.5>echo "hello" > output.txt

D:\scrcpy-win64-v2.5>type output.txt
"hello"

D:\scrcpy-win64-v2.5>

I closed the antivirus software and tried using Powershell and Terminal Administrator again, but the adb output redirection still gives empty file.

rom1v commented 2 months ago

In this comment, the user suggests a workaround: from your cmd.exe, try running cmd.exe, then run adb device -l > output.txt from that second terminal.

Holdmyhand commented 2 months ago

In this comment, the user suggests a workaround: from your cmd.exe, try running cmd.exe, then run adb device -l > output.txt from that second terminal.

Still empty.Funning Win11, it should be a Windows issue. Thank you very much for your patient explanation.

rom1v commented 2 months ago

Refs #3386 #3534

C1heck0ut commented 2 months ago

@rom1v ok,I tried using adb devices -l > output.txt, and the output was List of devices attached HT68A0201096 device product:marlin model:Pixel_XL device:marlin transport_id:10

C1heck0ut commented 2 months ago

@rom1v Then I used the 2.5 version of scrcpy, and the output showed scrcpy 2.5 <https://github.com/Genymobile/scrcpy> INFO: ADB device found: INFO: --> (usb) HT68A0201096 device Pixel_XL E:\android_re\scrcpy-win64-v2.5\scrcpy-server: 1 file pushed, 0 skipped. 162.9 MB/s (69624 bytes in 0.000s) [server] INFO: Device: [Google] google Pixel XL (Android 10) [server] WARN: Audio disabled: it is not supported before Android 11 INFO: Renderer: direct3d WARN: Demuxer 'audio': stream explicitly disabled by the device ERROR: Demuxer 'video': stream disabled due to connection error ERROR: Controller error Segmentation fault