[Android Q&A, Help & Troubleshooting] ptstr:
Hello,

I got the following phone:

Moto G Pure | 2021 | 2-Day battery | Unlocked | Made for US by Motorola | 3/32GB | 13MP Camera | Deep Indigo

https://www.amazon.com/gp/product/B09BTB5MKT/

The phone charger port is usb c. It has an Android 11 installed.

Assumptions:

-I got a 2-1 dongle that allows to have an ethernet connection and charger at the same time.

-Phone is not rooted.

-Wifi is disabled (since I'm using ethernet) so assume no adb over wifi setting can be used.

-Phone charger is not connected to the pc usb so assume no adb over usb setting can be used.

How can I enable adb over ethernet so I could launch scrcpy on the same local network to access the phone screen/sending adb commands through command line as needed?

I found a similar post about this from 2018 on xda: https://xdaforums.com/t/scrcpy-connection-help.3791716/

OP ended up ending writing the following update:

EDIT - problem solved: adb over ethernet instead of usb or wifi.

connected my android (galaxy view) to my network (ethernet) using the otg usb port and now, combined with the "adb over ethernet" app from the play store that i just discovered, the adb connection between my android and pc functions just as if they were connected by a usb cable, no more having to first connect the usb to get wifi to kick in, only to have to repeat this process again and again.

But when I tried to download "adb over ethernet" app, I noticed that it says that it requires root so I can't really use it?

A more recent comment on that post from 2022, someone said:

For others who find this in a search, you can get scrcpy to open up (and then kill the console to get it out of the way) on Android up to Android 11 using the "--tcpip=192.168.0.2:5555" option, but there's new capabilities in Android 12 now that eliminate totally the need for the initial USB connection.

In Android 12 you can also use scrcpy completely over Wi-Fi without first establishing the adb connection over USB like you need to do with Android 11.

There are new commands in the Android 12 Developer options to enable everything to be done over Wi-Fi which I've been using since May.

So it seems like the first option here (OP) is to root your phone and the second option (comment) is to upgrade your Android OS to version 12, which eliminates the need for a USB cable to enable adb debugging, but is there a way I could be able to connect to scrcpy on my Android 11 through the ethernet connection only without upgrading the Android version or rooting the phone?

When I currently try to run it this is the error I get (when only ethernet is connected, no wifi or usb connection to pc):

C:\scrcpy>scrcpy.exe

scrcpy 1.25 <https://github.com/Genymobile/scrcpy>

ERROR: Could not find any ADB device

ERROR: Server connection failed

Alternatively, can I enable adb over wifi in Android 11 so I could connect through scrpcy and without worrying that I might need to approve adb debugging in the small popup window that shows on the phone each time (or that shows periodically. In other words can that message be completely eliminated without rooting?). I do see under settings, developer options a setting called "Wireless debugging" (in addition to existing setting "USB debugging" which I had enabled when I used a direct USB connection the pc). So after enabling Wireless debugging, it asked me if I want to allow ADB debugging every time when my phone is connected to my local wifi network, I said yes. Now when I run scrcpy the following way using the local ip of my phone that was received by the wifi, I get the following error (IP was censored - this is only when wifi is connected, no usb connection to pc):

C:\scrcpy>scrcpy.exe --tcpip=192.168.X.X -b 2M -m 1024 --max-fps=15 --legacy-paste

scrcpy 1.25 <https://github.com/Genymobile/scrcpy>

INFO: Connecting to 192.168.X.X:5555...

cannot connect to 192.168.X.X:5555: No connection could be made because the target machine actively refused it. (10061)

ERROR: Could not connect to 192.168.X.X:5555

ERROR: Server connection failed

According to

Wireless debugging in Android 11

Android 11 developer preview has lots of new features to look but one of the coolest is Wireless debugging. It is a new method for…

levelup.gitconnected.com

“Requirements :

Device running with Android 11

SDK platform-tools with version ≥ 30.0.0.

Same Wi-Fi network for Android device and your PC

Wireless debugging

Android 11 supports deploying and debugging your app wirelessly from your workstation via Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB and contending with common USB connection issues, such as driver installation.”

So this should be supported in Android 11, then why scrcpy fails to connect to my phone ip?

Thank you.