Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
110.84k stars 10.62k forks source link

adb-server version mismatch + device offline error #2856

Open CodeSpoof opened 2 years ago

CodeSpoof commented 2 years ago

Environment

Describe the bug On terminal command scrcpy with tcp/ip connected device, I get the following output:

scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
error: no devices/emulators found
ERROR: "adb get-serialno" returned with value 1
ERROR: Could not get device serial
ERROR: Server connection failed

That's because scrcpy apperently uses an old adb-server version.

When I try connecting with scrcpy's version using scrcpy --raw-key-events --tcpip=192.168.178.48:39777, I get:

scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
INFO: Connected to 192.168.178.48:39777
adb: error: failed to get feature set: device offline
ERROR: "adb push" returned with value 1
ERROR: Server connection failed

although I can connect to it just fine with adb connect 192.168.178.48:39777.

rom1v commented 2 years ago

That's because scrcpy apperently uses an old adb-server version.

scrcpy just uses the available adb. Try a non-snap version.

rom1v commented 2 years ago

adb: error: failed to get feature set: device offline

Because the moment when scrcpy executes the command the device is reported offline by adb for some reason (in adb devices) :/ I could not reproduce.

rom1v commented 2 years ago

Does "device offline" happens 100℅ of the time when you use the --tcpip feature?

mxsrm commented 2 years ago

I have the same problem without tcpip, using an up-to-date pixel 6 and arch linux with newest dependencies...

mxsr@rivendell ~> adb devices
List of devices attached
18231FDF6005ZT  device

mxsr@rivendell ~> scrcpy -V verbose
scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
DEBUG: Device serial: 18231FDF6005ZT
DEBUG: Using server: /usr/share/scrcpy/scrcpy-server
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 243.0 MB/s (40067 bytes in 0.000s)
DEBUG: Screensaver enabled
adb: error: failed to read copy response
ERROR: "adb push" returned with value 1
ERROR: Server connection failed
mxsr@rivendell ~ [1]> adb devices
List of devices attached
18231FDF6005ZT  offline

mxsr@rivendell ~> adb --version
Android Debug Bridge version 1.0.41
Version 31.0.3-android-tools
Installed as /usr/bin/adb
mxsr@rivendell ~> scrcpy --version
scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
scrcpy 1.21

dependencies:
 - SDL 2.0.18
 - libavcodec 58.134.100
 - libavformat 58.76.100
 - libavutil 56.70.100
 - libavdevice 58.13.100
rom1v commented 2 years ago

Try with another cable/USB port. I'd say that the videostream makes USB/adb fail.

mxsrm commented 2 years ago

Another port worked. Now I feel dumb. Thank you.

yilksd commented 2 years ago

I think there is some restriction in snap. Snap can't access your adb . https://askubuntu.com/questions/1033344/how-to-give-snaps-access-to-somedir

novel36 commented 2 years ago

i had this problem once.i think the problem is snap.i just removed the snap version of scrcpy and i installed it using sudo apt install scrcpy and it worked

Larry1123 commented 2 years ago

For me the --tcpip flag is not there with the apt version

Command 'scrcpy' not found, but can be installed with:
sudo snap install scrcpy  # version v1.22, or
sudo apt  install scrcpy  # version 1.17-1

I tried pulling and installing using the simple build. Sadly that results in scrcpy when ran to just hang after printing version info and no nothing else.

Both the snap and apt version work fine over USB I want to be able to do wireless.

RezuwanHassan262 commented 2 years ago

This is the error I'm getting, any way to resolve this? It was working fine even yesterday when I got off from my computer and today, all of a sudden I'm getting this error

wwwwwwwwwww

rom1v commented 2 years ago
  1. Upgrade to v1.23
  2. What is the result of adb devices -l?
RezuwanHassan262 commented 2 years ago

I'm relatively new to this, please bear with me and my noobish questions.

  1. What is the upgrade command in this case for scrcpy?
  2. I'm not sure what you're talking about. Should I run this command to see the result?
rom1v commented 2 years ago

What is the upgrade command in this case for scrcpy?

  1. For Windows, download the archive of the latest version: https://github.com/Genymobile/scrcpy#windows
  2. Yes (double-click on "open_a_terminal_here.bat" once you extracted the release, then type adb devices -l)
adeosunsam commented 2 years ago

@rom1v , i keep getting the same error. this is what i got after running adb devices -l

List of devices attached f20f0719 offline transport_id:181

rom1v commented 2 years ago

@adeosunsam https://stackoverflow.com/questions/14993855/android-adb-device-offline-cant-issue-commands

akshadjoshi commented 2 years ago

Hello folks, I am using Ubuntu, and when I tried to use scrcpy to mirror my android device it showed me this error. Please help me with this problem Screenshot from 2022-08-07 15-22-04

(for some reason it worked when it was connected VIA USB but was creating issues when I was trying to connect wirelessly)

rom1v commented 2 years ago

If you have several devices listed in adb devices, then you must explicitly pass the serial. Install the latest version, and you could also pass -d for USB devices or -e for TCP/IP devices.