Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
113.52k stars 10.81k forks source link

scrcpy 2.0: Could not find any ADB device #3813

Closed OS2User closed 1 year ago

OS2User commented 1 year ago

Apparently I am too ignorant to set up and use scrncpy (v2.0) correctly.

1.) I installed the latest release from master for Linux according to Latest version

$ scrcpy
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>

2.) The target device is an Android 11 phablet. Developer options and USB debugging are enabled. There is an additional option "Wireless Debugging" available. When turned on, it uses a random port. Not sure what to make of it, so I left it turned off.

3.) The phablet is via WiFi on IP 192.168.0.3 The Linux machine is via WiFi on IP 192.168.0.4

4.) Following again as the next step Run

$ scrcpy
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
ERROR: Could not find any ADB device
ERROR: Server connection failed

So, what's still missing here?

rom1v commented 1 year ago

Your device must be detected by adb for scrcpy to work (i.e. adb devices must list your device).

Maybe you need some additional drivers: https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#device-not-detected

Does it work over usb?

rom1v commented 1 year ago

This is independent of the scrcpy version, it's just adb. You must make your device detected by adb.

OS2User commented 1 year ago

This is with WiFi only:

$ adb devices
List of devices attached

... and this with USB cable:

$ adb devices
List of devices attached
T12109280xxxxxx  unauthorized

There now is also a popup on then device, asking to Allow USB debugging?

rom1v commented 1 year ago

You must authorize USB debugging.

For Wifi, you must connect once via USB before hand (or pair your device using the wireless debugging option). See https://github.com/Genymobile/scrcpy/blob/master/doc/device.md#tcpip-wireless

OS2User commented 1 year ago

You must authorize USB debugging. Done:

$ adb devices
List of devices attached
T12109280xxxxxx  device

OK, with USB cable it's now working:

$ scrcpy --tcpip
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
INFO: Switching device T12109280xxxxxx to TCP/IP...
INFO: Enabling TCP/IP mode on port 5555...
INFO: Waiting for TCP/IP mode enabled...
INFO: TCP/IP mode enabled on port 5555
INFO: Connecting to 192.168.0.3:5555...
INFO: Connected to 192.168.0.3:5555
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 0.1 MB/s (52867 bytes in 0.387s)
[server] INFO: Device: along xxxxxxxxxx (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.2 (Compatibility Profile) Mesa 22.2.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 800x1280

... and with WiFi now as well 👍👏

$ scrcpy --tcpip=192.168.0.3
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.0.3:5555...
INFO: Connected to 192.168.0.3:5555
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 1.4 MB/s (52867 bytes in 0.036s)
[server] INFO: Device: along xxxxxxxxxx (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.2 (Compatibility Profile) Mesa 22.2.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 800x1280

Thank you very much for your swift support. 🤗

From my point of view as a non-programmer/-developer, it might be a good idea, to add those missing steps you provided here either to https://github.com/Genymobile/scrcpy/blob/master/README.md#prerequisites or to https://github.com/Genymobile/scrcpy/blob/master/doc/linux.md#run so that others like me don't run into the same problems setting scrncpy up.

rom1v commented 1 year ago

to add those missing steps you provided here either to https://github.com/Genymobile/scrcpy/blob/master/README.md#prerequisites

Ironically, I changed yesterday the link in prerequisites (1a80333747de602b03ca7ae6b8e58790eeefc3dc) because people did not find immediately how to enable USB debugging.

But on the old link, there was a note:

Note: When you connect a device running Android 4.2.2 or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.

Maybe the prerequisite section might be more verbose about this. Will think about it.

OS2User commented 1 year ago

Would the aforementioned additional Developer Option Wireless Debugging with those random ports have made any difference or been another option to set the device up?

rom1v commented 1 year ago

That's a different option, you have to pair your device with different commands manually: https://developer.android.com/studio/command-line/adb.html#wireless-android11-command-line

The link is mentioned at the end of this section: https://github.com/Genymobile/scrcpy/blob/dev/doc/device.md#tcpip-wireless

guyviner commented 1 year ago

After TCPIP mode is "enabled", is there a way to make that stick? IT seems every day or two, or after each device restart, TCP/IP mode is disabled yet again. What gives?!

rom1v commented 1 year ago

After the device restart, tcp mode is disabled. You need to root your device to make TCP mode survive a reboot.

OKCorral2016 commented 1 year ago

Just installed scrpy 2.2. And it works perfectly. However, my issue is that my phone screen is totally black. I thought I had USB-Debugging ON, but it doesnt seem to be the case and hence the "ADB not found" error.

Has anyone managed to turn USB debug on with a black screen, or any other workaround ? Thank you!.

@Genymobile : Many many thanks for the great tool you have developed ! Many thanks too for the clear installation procedure in https://github.com/Genymobile/scrcpy/blob/master/doc/macos.md