[Q] Is it possible to adb connect via wifi without configuring port on android? - General Questions and Answers

0 down vote favorite
I can connect via wifi by typing these codes in android terminal -
setprop service.adb.tcp.port 5555
stop adbd
start adbd
and connect iport on PC adb .. it is connected .. Is there any possibility to access without configuring on android !I mean looping port no:. Can it be possible ? kindly suggest me please !

Related

adbd in TCP listen mode by default?

At my university, the lab computers are locked down and won't allow the installation of Android's USB drivers. This prevents adb from connecting to the ADP1 via USB, but I can use another computer which does have USB permissions and use
Code:
adb tcpip 2222
to restart adbd in TCP listen mode on port 2222. Then, on a lab computer I can connect to the ADP1 using
Code:
adb connect <IP>:2222
and install packages, open a shell, etc.
My question is, how can adbd be preconfigured on the ADP1 to listen on a specified port on boot, instead of waiting for a USB connection and the above two commands?
This is "insecure" but it doesn't matter because the lab computers and wireless network are private, and the ADP1 has no SIM card and connects to the internet only via WiFi.
It seems that one way to do this involves editing the boot image to modify init.rc --- I'm prepared to do that, but I'm hesitant to spend the time trying it because I can't find any documentation saying what port adbd will listen on by default, or if it will listen on TCP at all.
tl;dr: Instructions on how to start adbd on boot in TCP listen mode? Thanks.
Did you find any answer to this? anybody knows how to enable it directly on phone without usb cable?
http://nookdevs.com/ADB_Over_USB
"By default, you won't be able to use adb over wifi, using this module/adbd. But if you set the persist.adb.tcp.port system property setprop persist.adb.tcp.port 5555 it will cause adbd to listen on the specified port so you can use adb over both usb and wifi. Note that adb over wifi is insecure and not recommended. Anyone on the same local network could potentially connect to your nook."
Maybe this will help you?
Not working
Gerdal said:
http://nookdevs.com/ADB_Over_USB
"By default, you won't be able to use adb over wifi, using this module/adbd. But if you set the persist.adb.tcp.port system property setprop persist.adb.tcp.port 5555 it will cause adbd to listen on the specified port so you can use adb over both usb and wifi. Note that adb over wifi is insecure and not recommended. Anyone on the same local network could potentially connect to your nook."
Maybe this will help you?
Click to expand...
Click to collapse
Thanks, but it didnt work. I tried the command in su mode, even restarted the adb service with stop/start command, no error but still can't connect to device over wifi. I can ping the device, so the connection is there. Any idea?
Solved
I finally solved the problem. these are the commands to enable adb over wifi:
Code:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
and to disable it:
Code:
setprop service.adb.tcp.port -1
stop adbd
start adbd
I assume you need su access to run it. I tested it and its working.
bohlool said:
I finally solved the problem. these are the commands to enable adb over wifi:
setprop service.adb.tcp.port 5555
[/CODE]
setprop has sucefully executed - no problem
how to restart this service ?
stop/start shows bad command or filename - which means command not found what is true since there is no shell command named start or stop
Click to expand...
Click to collapse
Worked for me
m32 said:
bohlool said:
I finally solved the problem. these are the commands to enable adb over wifi:
setprop service.adb.tcp.port 5555
[/CODE]
setprop has sucefully executed - no problem
how to restart this service ?
stop/start shows bad command or filename - which means command not found what is true since there is no shell command named start or stop
Click to expand...
Click to collapse
It worked for me. you can use my Widget to do it and see if it work or not, search market for "ADB over Wifi"
Click to expand...
Click to collapse
Hy!
I found my way of doing the same thing...
You have to enable dropbear ssh server on your device, and then you can forward the port 5037 (where adb listens by default on localhost only) to your computer trough ssh from your computer.
From your linux box, you can do this with this command:
ssh [email protected] -L 5555:localhost:5037
and then (but keep the ssh session open):
adb connect localhost
that's it
(note that you have to enable usb debugging for this to work!)
u-foka said:
Hy!
I found my way of doing the same thing...
You have to enable dropbear ssh server on your device, and then you can forward the port 5037 (where adb listens by default on localhost only) to your computer trough ssh from your computer.
From your linux box, you can do this with this command:
ssh [email protected] -L 5555:localhost:5037
and then (but keep the ssh session open):
adb connect localhost
that's it
(note that you have to enable usb debugging for this to work!)
Click to expand...
Click to collapse
that's pretty convenient. thanks.
Thanks and this works for me!!!
bohlool said:
Code:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
Click to expand...
Click to collapse

adb from smartphone to android wear with just bluetooth (no cables needed)

Hey folks,
Just wanted to share something I found that might be useful from time to time: how to send adb commands to android wear directly from your phone without any cables nor an extra PC.
This is a combination from different tutorials, made for different goals, so almost all credit goes to them
This worked from my Nexus 5 (4.4.4 stock, rooted) to a LG G Watch R (5.0.1)... but it should work with any combination as long as, your smartphone is rooted (but this is XDA so it has to be rooted )
First thing first, start bluetooth debugging in your android wear device (from the developer menu)
Now from your smartphone, start USB debugging (developer menu too)
At the bottom of the settings in the android wear app you should see a new option "Debugging over bluetooth", turn it on. You should get a message just below:
Host: disconnected
Target: connected
You will also get a permanent notification to remind you that debugging over bluetooth is active.
Disclaimer: su commands are powerful and with great powers comes great responsibility... so pay attention to what you do. In any case, I'm not responsable for any damage incurred to your phone, your android wear device, your cat, your home, your neighborhood, etc...
Open a terminal emulator in the smartphone paired to your wear device, where you can do "su" stuff, and run the following commands:
> su
> export HOME=/sdcard
> setprop service.adb.tcp.port 5555
> stop adbd
> start adbd
> adb devices <--- this should show you your own smartphone (with a emulator-5554, in my case)... you can actually shell into it if you like recursions .
SECURITY NOTE: This will allow the adb daemon to listen for tcp/ip connections from other machines connected to your wifi hotspot... I guess it will also allow machines sharing the same 4G cellular network you are using to connect, but what are the odds... In any case, and if I'm not wrong, any android version since 4.3 should give you a message telling you to accept the connection or not.... maybe in airplane mode with just bluetooth activated it would work and it would also be safer.
Continuing in terminal (the typical stuff we know already):
> adb forward tcp:4444 localabstract:/adb-hub
> adb connect localhost:4444
At this point your smartphone should buzz and ask you to allow a connection from your own phone. This time is the real deal, but just in case read carefully the message. It should say "Allow Wear Debugging?", so accept the connection and optionally mark the always accept option.
You will now have two emulated devices:
> adb devices
emulator-5554 device <--- the smartphone
localhost:4444 device <--- the android wear device
you need to specify for now on the target of your adb commands. For instance if you want to have a shell in the android wear device:
> adb -s localhost:4444 shell
That's it. Hope it works for everyone.
Ah! just one thing the value service.adb.tcp.port we set before disappears with a reboot (you can replace the word service with persist if you prefer to have it surviving the reboot... but I do not recommend it).
If you do not want to reboot but you want to disable it, run, as root:
> setprop service.adb.tcp.port -1
> stop adbd
> start adbd
to clean-up, from the terminal and as root:
> adb kill-server
You can also disable the adb debugging from the developer menu.
N.B. 1 . I guess the easiest thing to do would be to put all those commands in a script file and then just run as root:
> sh script_to_adb_wear.sh
N.B.2. I have not tried with fastboot... but that would surprise me if it works.... In any case, and IMHO, fastboot should only be used with the device connected to a computer via usb.
This isnt working for me on my OPO running CM12 unofficial... Running the commands gives me a blank adb devices window, any advice?
Hi,
I guess you get the empty device list after the "start adbd" command, right?
Just to be sure, before running the adb devices commad do "adb kill-server"
If adb devices still gives you an empty list of devices try with:
> adb connect localhost:5555
And check again. Usually, what should happen, the adb server detects a adbd listening in the port 5555 and it considers it is an android emulator and it connects to it automatically. Maybe in your case it is not connecting, so the connect command might help. Once you hace at least your phone showing you can run the other commands to access the watch.
Let me know if this helps
gusano38 said:
Hi,
I guess you get the empty device list after the "start adbd" command, right?
Just to be sure, before running the adb devices commad do "adb kill-server"
If adb devices still gives you an empty list of devices try with:
> adb connect localhost:5555
And check again. Usually, what should happen, the adb server detects a adbd listening in the port 5555 and it considers it is an android emulator and it connects to it automatically. Maybe in your case it is not connecting, so the connect command might help. Once you hace at least your phone showing you can run the other commands to access the watch.
Let me know if this helps
Click to expand...
Click to collapse
Works like a charm thanks for the help
Where is the adb binary? Adb isn't a recognized command
My binary is in /system/bin/adb
Sideloading...
Really great, all works... until I try to sideload an APK. I keep getting invalid apk file. I'm doing it by:
adb -s _____ install ____.apk
but it's not working. Any suggestions?
gusano38 said:
Hey folks,
Just wanted to share something I found that might be useful from time to time: how to send adb commands to android wear directly from your phone without any cables nor an extra PC.
This is a combination from different tutorials, made for different goals, so almost all credit goes to them
This worked from my Nexus 5 (4.4.4 stock, rooted) to a LG G Watch R (5.0.1)... but it should work with any combination as long as, your smartphone is rooted (but this is XDA so it has to be rooted )
First thing first, start bluetooth debugging in your android wear device (from the developer menu)
Now from your smartphone, start USB debugging (developer menu too)
At the bottom of the settings in the android wear app you should see a new option "Debugging over bluetooth", turn it on. You should get a message just below:
Host: disconnected
Target: connected
You will also get a permanent notification to remind you that debugging over bluetooth is active.
Disclaimer: su commands are powerful and with great powers comes great responsibility... so pay attention to what you do. In any case, I'm not responsable for any damage incurred to your phone, your android wear device, your cat, your home, your neighborhood, etc...
Open a terminal emulator in the smartphone paired to your wear device, where you can do "su" stuff, and run the following commands:
> su
> export HOME=/sdcard
> setprop service.adb.tcp.port 5555
> stop adbd
> start adbd
> adb devices <--- this should show you your own smartphone (with a emulator-5554, in my case)... you can actually shell into it if you like recursions .
SECURITY NOTE: This will allow the adb daemon to listen for tcp/ip connections from other machines connected to your wifi hotspot... I guess it will also allow machines sharing the same 4G cellular network you are using to connect, but what are the odds... In any case, and if I'm not wrong, any android version since 4.3 should give you a message telling you to accept the connection or not.... maybe in airplane mode with just bluetooth activated it would work and it would also be safer.
Continuing in terminal (the typical stuff we know already):
> adb forward tcp:4444 localabstract:/adb-hub
> adb connect localhost:4444
At this point your smartphone should buzz and ask you to allow a connection from your own phone. This time is the real deal, but just in case read carefully the message. It should say "Allow Wear Debugging?", so accept the connection and optionally mark the always accept option.
You will now have two emulated devices:
> adb devices
emulator-5554 device <--- the smartphone
localhost:4444 device <--- the android wear device
you need to specify for now on the target of your adb commands. For instance if you want to have a shell in the android wear device:
> adb -s localhost:4444 shell
That's it. Hope it works for everyone.
Ah! just one thing the value service.adb.tcp.port we set before disappears with a reboot (you can replace the word service with persist if you prefer to have it surviving the reboot... but I do not recommend it).
If you do not want to reboot but you want to disable it, run, as root:
> setprop service.adb.tcp.port -1
> stop adbd
> start adbd
to clean-up, from the terminal and as root:
> adb kill-server
You can also disable the adb debugging from the developer menu.
N.B. 1 . I guess the easiest thing to do would be to put all those commands in a script file and then just run as root:
> sh script_to_adb_wear.sh
N.B.2. I have not tried with fastboot... but that would surprise me if it works.... In any case, and IMHO, fastboot should only be used with the device connected to a computer via usb.
Click to expand...
Click to collapse
AJWizkid said:
Really great, all works... until I try to sideload an APK. I keep getting invalid apk file. I'm doing it by:
adb -s _____ install ____.apk
but it's not working. Any suggestions?
Click to expand...
Click to collapse
Adb -s localhost:4444 install my.apk
Where can I download the script?
¯\_(ツ)_/¯
thegrim11 said:
Where can I download the script?
¯\_(ツ)_/¯
Click to expand...
Click to collapse
Here's the script.
Using Root Explorer:
Create a folder under /system and copy adbgwrbt.sh there
Set permissions to 100 (execute for owner)
Tap script and hit execute
Profit
No credit. Just copied and pasted from OP. Thank you so much for this gusano!! Always find myself needing this . Now if you could just figure out fastboot [emoji57]
Oh my, thank you very much, I've been trying to do this ever since I got my watch but just didn't have the skills (still managed to fins an other way to send files from the phone to the watch and even install apk's), you're great man!
hatefuel19 said:
Now if you could just figure out fastboot [emoji57]
Click to expand...
Click to collapse
I'm pretty sure that in fastboot mode (bootloader) the bluetooth driver is not loaded, so I guess having fastboot with bluetooth is not possible. Furthermore, I would not trust a bluetooth connection to do things that could brick your watch... of course, the pogo pins is not what I call a super trustable connection either
The sarcasm was lost apparently ?
Grr. Got a replacement phone from insurance and the binary isn't there. Can someone please pm me the adb from system/bin?
Sent from my XT1060 using Tapatalk
gusano38 said:
Hey folks,
Just wanted to share something I found that might be useful from time to time: how to send adb commands to android wear directly from your phone without any cables nor an extra PC.
This is a combination from different tutorials, made for different goals, so almost all credit goes to them
This worked from my Nexus 5 (4.4.4 stock, rooted) to a LG G Watch R (5.0.1)... but it should work with any combination as long as, your smartphone is rooted (but this is XDA so it has to be rooted )
First thing first, start bluetooth debugging in your android wear device (from the developer menu)
Now from your smartphone, start USB debugging (developer menu too)
At the bottom of the settings in the android wear app you should see a new option "Debugging over bluetooth", turn it on. You should get a message just below:
Host: disconnected
Target: connected
You will also get a permanent notification to remind you that debugging over bluetooth is active.
Disclaimer: su commands are powerful and with great powers comes great responsibility... so pay attention to what you do. In any case, I'm not responsable for any damage incurred to your phone, your android wear device, your cat, your home, your neighborhood, etc...
Open a terminal emulator in the smartphone paired to your wear device, where you can do "su" stuff, and run the following commands:
> su
> export HOME=/sdcard
> setprop service.adb.tcp.port 5555
> stop adbd
> start adbd
> adb devices <--- this should show you your own smartphone (with a emulator-5554, in my case)... you can actually shell into it if you like recursions .
SECURITY NOTE: This will allow the adb daemon to listen for tcp/ip connections from other machines connected to your wifi hotspot... I guess it will also allow machines sharing the same 4G cellular network you are using to connect, but what are the odds... In any case, and if I'm not wrong, any android version since 4.3 should give you a message telling you to accept the connection or not.... maybe in airplane mode with just bluetooth activated it would work and it would also be safer.
Continuing in terminal (the typical stuff we know already):
> adb forward tcp:4444 localabstract:/adb-hub
> adb connect localhost:4444
At this point your smartphone should buzz and ask you to allow a connection from your own phone. This time is the real deal, but just in case read carefully the message. It should say "Allow Wear Debugging?", so accept the connection and optionally mark the always accept option.
You will now have two emulated devices:
> adb devices
emulator-5554 device <--- the smartphone
localhost:4444 device <--- the android wear device
you need to specify for now on the target of your adb commands. For instance if you want to have a shell in the android wear device:
> adb -s localhost:4444 shell
That's it. Hope it works for everyone.
Ah! just one thing the value service.adb.tcp.port we set before disappears with a reboot (you can replace the word service with persist if you prefer to have it surviving the reboot... but I do not recommend it).
If you do not want to reboot but you want to disable it, run, as root:
> setprop service.adb.tcp.port -1
> stop adbd
> start adbd
to clean-up, from the terminal and as root:
> adb kill-server
You can also disable the adb debugging from the developer menu.
N.B. 1 . I guess the easiest thing to do would be to put all those commands in a script file and then just run as root:
> sh script_to_adb_wear.sh
N.B.2. I have not tried with fastboot... but that would surprise me if it works.... In any case, and IMHO, fastboot should only be used with the device connected to a computer via usb.
Click to expand...
Click to collapse
Loved your post!
Thing is I get an error each time I try the script.
I own a rooted LG G3 ChupaChups 4.2 ROM and a LG G Watch R
Thanx in advance to your help.
setprop service.adb.tcp.port 5555
Sent from my HTC One_M8 using Tapatalk
Unauthorized
ADB tells me that my device has not authorized itself as an adb connection. The problem is since it's not actually a standard USB debugging connection I don't get a popup to mark my device as trusted. Is there anyway to work around this?
I always get the error from the pictures
N4 Android 6.0 Frank rooted xposed
LG g watch wear 5.1.1 rooted (no idea what adventages)
Gesendet von meinem Nexus 4 mit Tapatalk
---------- Post added at 07:10 AM ---------- Previous post was at 07:09 AM ----------
J0SH1X said:
I always get the error from the pictures
N4 Android 6.0 Frank rooted xposed
LG g watch wear 5.1.1 rooted (no idea what adventages)
Gesendet von meinem Nexus 4 mit Tapatalk
Click to expand...
Click to collapse
And yes I did enable all debugging setting in companion app on phone on wear
Gesendet von meinem Nexus 4 mit Tapatalk
i have this problem not connect to localhost 4444. i have cm13
adb commands won't work for me.

Help with using ADB commands wirelessly?

I have a phone (Samsung A10E) that will not connect to the PC via USB (It's not the PC, I have a second of the same phone which connects fine, so SDK install and phone drivers are good). It is not rooted.
Is there anyway to perform ADB TCPIP 5555 on the phone itself or otherwise set the phone to accept wireless ADB commands with only the phone? (also no wireless debugging option available under Dev Options).
Thx for any suggestions!
NO.
A working ADB USB-connection is required to run
Code:
adb tcpip 5555
command

How to add WiFi network over ADB without root?

If a device has no root, what ADB commands can I use to connect that device to WiFi? I need to be able to input SSID name, password, static local IP, DNS, etc. - all over ADB and without root.
I am not talking about ADB over WiFi over TCP port 5555. I am talking about connecting an Android device via USB cable and the connecting that Android device to WiFi, assuming the device has no WiFi networks added.
To bring up Android's Wi-Fi Settings via ADB you run
Code:
adb devices
adb shell "am start -a android.settings.WIFI_SETTINGS"
I'm not sure I understand the OP's question where it matters greatly whether the OP is on non-rooted Android 10 and below or non-rooted Android 11 and above.
Non-root Android 11 and above no longer needs the USB cable for adb to connect between Android and the PC via Wi-Fi.
There's more information here...
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
(PSA) Using the new Android 12 TILE for 'Developer options' 'Wireless debugging' to establish adb connection over Wi-Fi without USB
What's the difference between Windows/Android adb "connect" versus adb "pair" when mirroring Android 12 over Wi-Fi onto a Windows PC?
some newer devices, like Samsung will let you use cmd binary.
So to connect to network look at "adb shell cmd wifi"
Currently, it's somethig like $ adb shell cmd wifi connect-network bssid passphrase network_type

adb over ethernet in Android 11

Hi. I've been playing with connecting my phone via ethernet, and notice that since (stock) android 11, enabling wireless debugging no longer enables generic local network adb access, it's now specifically for wireless only adb. Anyone know if there's a way to enable ethernet adb debugging, or where I can ask Google about it?
try
setprop persist.adb.tcp.port 5555
stop adbd
start adbd
adb connect <device ip>:5555
Ah, great idea, but requires root and I have not rooted or replaced the rom. Guess I may just have to wait until I have enough time, I suppose the warranty is close to finished.

Categories

Resources