Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.21k stars 10.73k forks source link

scrcpy over Wi-Fi - could not find ADB device #3212

Open bmscmoreira opened 2 years ago

bmscmoreira commented 2 years ago

Environment

Describe the bug When starting scrcpy, even with device connected via ADB TCPIP, results in connection error (could not find ADB device)

NOTE: the first adb devices command was issued with the USB cable plugged in; then I removed the USB cable and issued the command again, and the device was still connected. If I leave USB cable plugged in, scrcpy works fine.

Please paste terminal output in a code block.

bmscmoreira@raspberrypi:~ $ adb tcpip 5555
restarting in TCP mode port: 5555

bmscmoreira@raspberrypi:~ $ adb connect 192.168.9.42:5555
connected to 192.168.9.42:5555

bmscmoreira@raspberrypi:~ $ adb devices
List of devices attached
94606463    device
192.168.9.42:5555   device

bmscmoreira@raspberrypi:~ $ adb devices
List of devices attached
192.168.9.42:5555   device

bmscmoreira@raspberrypi:~ $ scrcpy
scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
ERROR: Could not find any ADB device
ERROR: Server connection failed
rom1v commented 2 years ago

adb server version (41) doesn't match this client (39); killing...

It uses a different adb, because snap.

You could try:

ADB=$(which adb) scrcpy

Or don't use the snap version.

FYI, you could use scrcpy --tcpip while your device is plugged.

bmscmoreira commented 2 years ago

Thank you for the reply. Not sure how it worked, since I'm given several info/warn/error messages on the terminal, but this sequence of commands worked for me (using snap version):

Starting with USB cable plugged in:

adb tcpip 5555 adb connect IP:5555 scrcpy --tcpip scrcpy -e

Then removed the USB cable.

ben-mathu commented 2 years ago

Using scrcpy --tcpip worked. Thanks

masavini commented 2 years ago

adb server version (41) doesn't match this client (39); killing...

It uses a different adb, because snap.

You could try:

ADB=$(which adb) scrcpy

this won't work if adb is in a standard path like /usr/bin, which is not mounted inside the snap container:

$ ADB=/usr/bin/adb scrcpy
scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
exec: No such file or directory
ERROR: Command not found: [/usr/bin/adb], [start-server]
ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
INFO: You may install 'adb' by "apt install adb"
ERROR: Could not execute "adb start-server"
ERROR: Could not start adb daemon
ERROR: Server connection failed

in such a case you should move or copy adb somewhere in your HOME (which is mounted inside the snap container) and then pass the new adb path to scrcpy:

ADB=/home/<user>/<adb path> scrcpy