Genymobile/scrcpy

Could not list ADB devices, ERROR: Server connection failed

Opened this issue · 8 comments

Please read the prerequisites to run scrcpy.

Also read the FAQ and check if your issue already exists.

Environment

  • OS: Windows
  • Scrcpy version: 3.3.3
  • Installation method: Windows release
  • Device model:
  • **Android version:**14

Describe the bug

when I run scrcpy, it shows:

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>scrcpy.exe
scrcpy 3.3.3 https://github.com/Genymobile/scrcpy
ERROR: Could not list ADB devices
ERROR: Server connection failed

actually, when I run adb devices, it could show the device. but still show this error.

Before I used the old version and could worked well, but I dont know recently it show this error.
even I download the latest version of the scrcpy.

Please paste terminal output in a code block.

Please do not post screenshots of your terminal, just post the content as text instead.

rom1v commented

What is the result of adb devices -l?

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>adb devices -l
List of devices attached
192.168.199.105:5555 device product:* model:* device:* transport_id:1

I could found the device exist when I use the adb command. and I also control control the device by adb commands.

rom1v commented

This output is correctly parsed by scrcpy:

diff --git app/tests/test_adb_parser.c app/tests/test_adb_parser.c
index 362b254ff..af0000043 100644
--- app/tests/test_adb_parser.c
+++ app/tests/test_adb_parser.c
@@ -5,6 +5,24 @@
 #include "adb/adb_device.h"
 #include "adb/adb_parser.h"
 
+static void test_issue6429(void) {
+    char output[] =
+        "List of devices attached\n"
+        "192.168.199.105:5555 device product:HP4A01-Elisa model:Helo3 device:HP4AD-Elisa transport_id:1\n";
+
+    struct sc_vec_adb_devices vec = SC_VECTOR_INITIALIZER;
+    bool ok = sc_adb_parse_devices(output, &vec);
+    assert(ok);
+    assert(vec.size == 1);
+
+    struct sc_adb_device *device = &vec.data[0];
+    assert(!strcmp("192.168.199.105:5555", device->serial));
+    assert(!strcmp("device", device->state));
+    assert(!strcmp("Helo3", device->model));
+
+    sc_adb_devices_destroy(&vec);
+}
+
 static void test_adb_devices(void) {
     char output[] =
         "List of devices attached\n"
@@ -257,6 +275,7 @@ int main(int argc, char *argv[]) {
     (void) argc;
     (void) argv;
 
+    test_issue6429();
     test_adb_devices();
     test_adb_devices_cr();
     test_adb_devices_daemon_start();

Please execute adb devices -l then immediately execute scrcpy, then execute adb devices -l again, and post a capture of the whole console output at once (including the three commands).

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>
E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>adb devices -l
List of devices attached
192.168.199.105:5555 device product:HP4A01-Elisa model:Helo3 device:HP4AD-Elisa transport_id:1

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>adb devices -l
List of devices attached
192.168.199.105:5555 device product:HP4A01-Elisa model:Helo3 device:HP4AD-Elisa transport_id:1

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>scrcpy.exe
scrcpy 3.3.3 https://github.com/Genymobile/scrcpy
ERROR: Could not list ADB devices
ERROR: Server connection failed

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>adb devices -l
List of devices attached
192.168.199.105:5555 device product:HP4A01-Elisa model:Helo3 device:HP4AD-Elisa transport_id:1

E:\Tool\scrcpy-win32-v3.3.3\scrcpy-win32-v3.3.3>

@rom1v Actaully, the adb connection is stable.

rom1v commented

Looks like #3386 #3534 #5001: reading the output of a process (here the one spawned to execute adb devices -l) fails, for an unknown reason (system permission issue).

To confirm, execute adb devices -l > output.txt. Does output.txt contain the expected output of adb devices -l?

Yeah correct, after adb devices -l > output.txt, the file is empty

and it work before. I dont know why it suddenly dont have the permission. so sad

resolve my issue by downgrade the adb version refer to below link:

#5001

Thanks for your help.

use the downgrade adb version is not compatible with the new version. so if someone have better solution, please tell me.