scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

How to enable adb over TCP/IP without USB cable

Open recnac-itna opened this issue 5 years ago • 5 comments

First I want to say it is a really cool project and I have learned a lot from it. Thanks.

In my scenario, I want to mirror android to android by wireless. "tailcode" has provided a solution. But I found we still need to "enable adb over TCP/IP on your device: adb tcpip 5555" by USB cable. Using USB debug is inconvinient in my scenario. So how can we make this step in Android application?

I have googled and tried, this post mentioned that we can apply for "su" previledge, "setprop service.adb.tcp.port 5555" and restart adbd. But I have no permission to access "su" even in rooted device. I am stocking here now.

That is what I tried so far. Actually I want to ask how can I enable adb over TCP/IP in Android application instead of USB cable? Other solution is OK too. Thanks for any help.

recnac-itna avatar Jan 13 '20 11:01 recnac-itna

I was able to enable the tcp/ip ADB through the developer options. In my Android 9 device it's in Settings > System > Advanced (it's just a dropdown) and the Developer Options. There is a section called "Debugging" with an option "ADB over network", once I enable that, it shows my local ip with the port 5555. If you can't find the Developer Options, make sure the option is enabled but tapping 5 times in quick succession on you device's build number (Found usually in settings below the android version).

More info on how to enable and access the Developer Options can be found here and here

skourismanolis avatar Jan 13 '20 13:01 skourismanolis

Thanks for your reply. But I can not find the "ADB over network" in "Debugging" from my Android devices (both OPPO and Xiaomi). Sorry I didn't make it clear. Actually my point is make this operation transparent to users, so I want to achieve this step in android code. Is that possible?

recnac-itna avatar Jan 14 '20 01:01 recnac-itna

You usually need root permissions to enable ADB over Wi-Fi unless you're using a custom ROM which allows you to do it.

See this thread on Stack overflow for more info

mukul29 avatar Jan 17 '20 17:01 mukul29

unless you're using a custom ROM

I am using a custom ROM so apparently that's why I have it.

skourismanolis avatar Jan 17 '20 22:01 skourismanolis

I was able to connect without usb cable. For that you need to enable wireless debugging in you android(mine was 12) phone. After enabling wireless debugging in developers options. You can see ip address and port enter same. 1)adb connect ip:port 2)if you are using Android studio then open device manager> physical device> pair using wifi> qr code will popup scan qr code from wireless debugging menu options and your device will get connected

surajgju avatar Nov 15 '22 05:11 surajgju