Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
105.93k stars 10.27k forks source link

Cannot connect to multiple devices using the --serial argument #4819

Open risharde opened 3 months ago

risharde commented 3 months ago

Environment

Describe the bug scrcpy works fine for a single adb connected device in which I specify the --serial=ip:port However attempting to connect to two devices simultaneously results in the following (P.S I saw the thread about tunneling but I have no tunneling inbetween) :

CLIENT 1 COMMAND WORKS: scrcpy --serial=ip1:5555 --max-size=1024 -b 200000 CLIENT 2 COMMAND DOES NOT WORK: scrcpy --serial=ip2:5555 --max-size=1024 -b 200000 where ip1 is the first IP of firestick 1 and ip2 is the first IP of firestick 2 Both are on the same network

If I try client 2's connection first and then client 1, client 2 works as well, but client 1 does not.

adb.exe: error: more than one device and emulator
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27183, retrying on 27184
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27184, retrying on 27185
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27185, retrying on 27186
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27186, retrying on 27187
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27187, retrying on 27188
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27188, retrying on 27189
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27189, retrying on 27190
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27190, retrying on 27191
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27191, retrying on 27192
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27192, retrying on 27193
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27193, retrying on 27194
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27194, retrying on 27195
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27195, retrying on 27196
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27196, retrying on 27197
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27197, retrying on 27198
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27198, retrying on 27199
adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
ERROR: Could not forward any port in range 27183:27199
ERROR: Server connection failed
rom1v commented 3 months ago
adb.exe: error: more than one device and emulator
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'

I bet this is with your Android 5 device: #5.

adb.exe: error: more than one device/emulator
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27183, retrying on 27184

This one is not expected (the bug in Android 5 was specific to adb reverse), you should never get the error more than one device/emulator with adb forward (scrcpy always passes -s <serial>).

When this happens, try manually:

adb forward -s ip:5555 tcp:27183 localabstract:scrcpy

What is the output/error?

scrcpy version: Latest at this time

What is your exact scrcpy version?