I have connected an android device over tcpip using adb connect <ipaddress>. I am able perfrom all operations of adb on this devices.
However when I issues a command adb -s <ip>:5555 reboot, I see that prompt simply hangs and reboot is not being performed on the devices.
Is this a known limitation of adb over tcpip?
Are there any other ways to issue reboot commands in such cases?
Thanks in advance
Command adb -s :5555 reboot is incorrect, adb -s <IP Address>:<5555> reboot is correct.
If your device IP is 172.16.7.123, use the following.
$ adb connect 172.16.7.123
Lets say your list of devices show the following
$ adb devices
List of devices attached
172.16.7.123:5555 device
0554e0700a67240d device
The correct way to reboot the device using adb is
$ adb -s 172.16.7.123:5555 reboot
After issuing the above command, your prompt will hang since the adbd daemon is killed on the device.
To return it to normal, use adb disconnect 172.16.7.123 on another prompt and it will return to normal.
Related
I'm using termux in Android
I connect my using tcpip
I can't excute command reason show multiple devices connected
adb devices
List of devices attached
emulator-5554 device
adb allows multiple devices to be connected which will not allow to run the shell
you can try restarting the server using the following command and try again
adb kill-server
adb start-server
it worked for me some one already mentioned about the -s Serial number ( phone / emulator id )
adb -s SERIAL shell
so that will also be a good option to try
you can also try command line to connect with the target using
adb connect xxx.xxx.xxx.xxx:port
you may also try
adb disconnect
and retry
Good luck
I used to be able to setup wireless ADB no problem (plug in, adb tcpip 5555, adb connect ), now it gets stuck indefinitely during the "adb tcpip 5555" command. Wired adb still works fine, so does setting up wireless ADB through apps in play store, just not via cmd. Between wireless working and now not working, I did a bunch of things so any of them may or may not be the problem:
1) Reformatted computer (Same OS)
2) Redownloaded the SDK needed for Android Development
3) Went from ParanoidAndroid to GPE on my HTC One.
Anyone have any idea what the problem is?
You can emulate what apps do with these steps on your device with root and android terminal emulator:
$ adbd stop
$ setprop service.adb.tcp.port 5555
$ adbd start
Then use adb connect XXX.XXX.XXX.XXX where XXX.XXX.XXX.XXX is your ip address found from:
$ ifconfig wlan0 | awk '/inet addr/ {print $2}' | cut -d: -f2
You can check if your connection is establed using netstat | grep 5555. You should see a tcp entry with your ip address and port for adb connectivity.
If your device is rooted then it is very simple to establish a wireless connection, you don't even need a USB cable. Download this app from Google Play https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=en
It worked for me at least, and as can be seen from the app rating it works for almost all.
-----Enter the command adb kill-server at command prompt-----
C:>adb kill-server
-----Enter the command adb devices-----
C:>adb devices
List of devices attached
daemon not running; starting now at tcp:5037
daemon started successfully
DeviceID device
-----DeviceID is the unique ID of connected device-----
-----Enter the command adb tcpip 5555-----
C:>adb tcpip 5555
restarting in TCP mode port: 5555
-----will see the response as given above -----
-----Enter the command adb connect 1.1.2.2-----
-----1.1.2.2 is the mobile device IP-----
C:>adb connect 1.1.2.2
connected to 1.1.2.2:5555
-----will see the response as given above -----
-----Now u can use 1.1.2.2:5555 ID as wireless to connect device-----
I need remote ADB shell..
I know that we have to issue "ADB tcpip ".. to change ADB server to TCP listening mode.
But, the problem is that my phone is not rooted, and I do not have USB cable.
I can't issue tcpip command since I do not have USB cable,,
I can't change default.prop file as the phone is not rooted.
Is there any other ways to change ADB server to TCP listening mode???
I found an articel that says you can execute setprop persist.adb.tcp.port 5555 to make tcpip mode autostart after reboot.
The problem is, you must run this command as root.
On my device unfortunally the command su doeas not exist.
Here is the orginal Permanent network debugging on android
EDIT: I discovered, that the su command is only available when your device is rooted.
So the solution only works when you have a rooted phone
The simple answer is: no, you can't.
As you said, you can't access the prop file and don't have a cable to change with ADB. The only way is you find the port via an Android terminal emulator (a.k.a Termux)
For anyone looking for a better answer:
YES, YOU CAN!!
When you try to execute "adb tcpip 5555" without an USB cable, it returns:
"error: no devices/emulators found"
Emulators?? After googling I found the way and made a batch file that connects my device directly through WIFI, no cables needed at all:
set /p ip= Device IP:
:CONNECT
if "%CD%"=="C:\" goto ROOT
cd ..
goto CONNECT
:ROOT
cd ...Android\Sdk\emulator
echo.
echo Starting emulator...
start /MIN emulator -avd Nexus_5X_API_29_x86 -no-window
(you can check other avaliable devices with "emulator -list-avds")
cd ..
cd platform-tools
adb wait-for-device
echo.
echo Emulator started.
echo Connecting with device...
adb tcpip 5555
adb connect %ip%
echo.
echo Closing emulator...
(you need it just to be able to execute "adb tcpip 5555")
adb -s emulator-5554 emu kill
(you can check the name with "adb devices")
To enable wireless debug need to configure the ADB command. (in mac os)
Step1:- First of all need to enable adb command. (check SDK tool and install command-line tools)
Step2:- connect the device with a USB cable after that run the below command.
command: adb devices
the above command will show a list of connected mobiles.
Step3:- after that, we need to configure TCPIP protocol:
e.g : adb tcpip 5556
Step4:- Run command to connect the device.
command: adb connect your_ip:port_address
eg:- adb connect 192.168.1.152:5556
If you are using the stock android os system, then you can enable remote debugging in Settting -> developer options.
I want to connect to the Android device using adb over the network. I am familiar with How can I connect to Android with ADB over TCP? and with https://developer.android.com/guide/topics/usb/index.html and follow the guidelines. Specifically, I did the following:
# adb kill-server
# adb tcpip 5555
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
restarting in TCP mode port: 5555
# adb connect 192.168.1.101:5555
unable to connect to 192.168.1.101:5555:5555
Due to the last error, I also tried
# adb connect 192.168.1.101
unable to connect to 192.168.1.101:5555
I also tried to restart the device itself, but it did not help.
Any reason why it does not work?
Update: To clear any doubts, I am sure that this is my device internal IP address.
I've been having the same issue with my unrooted device. And contrary to popular belief it seems that adb tcpip <port> requires either an emulator or a debug build or root privileges; at least according to the source code.
master branch: https://github.com/android/platform_system_core/blob/master/adb/adb.c#L898 look at should_drop_privileges which prevents https://github.com/android/platform_system_core/blob/master/adb/adb.c#L966 adb_main to open a TCP/IP socket connection.
In older branches the logic for identifying the privileges of adbd were in adb_main itself. See: https://github.com/android/platform_system_core/blob/froyo-release/adb/adb.c#L860
So, to further prove that adbd won't enter TCP/IP mode (even though adb tcpip gives out no errors), look at the following:
adb shell getprop | grep 'ro.secure\|debuggable\|qemu', output for my device:
[ro.secure]: [1]
[ro.debuggable]: [0]
This does not meet the conditions of being able to get a secure value of 0 in adbd, since I'm not running an emulator (which needs TCP/IP by default), I'm not running a debuggable build of Android, and I'm not root.
Furthermore if you issue an adb shell netstat command you'll see that there's nobody listening on port 5037 or 5555 or whatever else you supplied to the tcpip command as expected from an adbd running in TCP/IP mode.
Hope this helps, good luck!
The ability to restart adbd using tcpip transport can vary from device to device. Without knowing exactly which device you're using it's very difficult to know the exact cause.
I tested "adb tcpip 5555" on a Galaxy Nexus (takju) running 4.2.1 and found it to work. I also tested on a couple other devices and those did not work.
I managed to get it to work using root access on a Motorola Droid 3. Note that ro.secure=1 and ro.debuggable=0 still. I simply by manually set service.adb.tcp.port" to "5555" as such:
devbox:~/droid3$ adb shell
shell#cdma_solana:/$ getprop | grep 'ro.secure\|debuggable\|qemu'
[ro.secure]: [1]
[ro.debuggable]: [0]
shell#cdma_solana:/$ su -c 'setprop service.adb.tcp.port 5555'
shell#cdma_solana:/$ exit
devbox:~/droid3$ adb tcpip 5555
restarting in TCP mode port: 5555
devbox:~/droid3$ adb connect 172.16.0.14
connected to 172.16.0.14:5555
devbox:~/droid3$ adb -s 172.16.0.14:5555 shell
shell#cdma_solana:/$
Although I specified 5555 when running "adb tcpip" it gets ignored by the device. It seems that this particular device does not have the required access to set the "service.adb.tcp.port" property without root.
Similarly, you can go back to USB as such:
shell#cdma_solana:/$ getprop | grep adb
[persist.service.adb.enable]: [1]
[ro.sys.atvc_allow_all_adb]: [0]
[persist.adb.tcp.port]: []
[init.svc.adbd]: [running]
[service.adb.tcp.port]: [5555]
shell#cdma_solana:/$ su -c 'setprop service.adb.tcp.port ""'
shell#cdma_solana:/$ exit
devbox:~/droid3$ adb -s 172.16.0.14:5555 usb
restarting in USB mode
devbox:~/droid3$ adb shell
shell#cdma_solana:/$
The reasons that this might not work on other devices vary.
On the Galaxy Nexus I tested, the shell user is able to set the "service.adb.tcp.port" property. It's not clear why this differs at this time.
Interestingly it seems the droid3 will not continue to listen on USB if you enable TCPIP. However, the Galaxy Nexus will.
Hope this helps..
PS. See also: How can I connect to Android with ADB over TCP?
I also met same scenario as your, TCPIP setup succeseed, but adb connet failed. I finally found it's my network problem, the ping also failed under that scenairo.
After i made the ping works, the adb connect works as well. So, my suggestion is to check your network environment.
Hi there I know this is an old question but I was having the same problem. I am not sure it is the same case for you but the problem for me was that I was connecting my Android device through a USB expansion, as soon as I connected the Android device directly to the USB port in my MAC it worked.
Just to clarify try to connect the Android device directly to the computer or try switching the USB port.
Trying to configure ADB so that I can debug it via wifi, I have checked on Google but not getting proper resolution.
Tell me what to enter in port address, device ip.
Moreover setprop service.adb.tcp.port command is running when i give space between set and prop, bit confuse...
Seeking for help
I got the following article, and wanted help in the same context.
disconnect device from usb then tell it to listen on 4455
adb tcpip 4455
restarting in TCP mode port: 4455
connect to the device using a specified ip:port. my device is using wifi
adb connect 192.168.1.103:4455
connected to 192.168.1.103:4455
now do normal adb commands over tcp
adb shell
when your done, you can put it back in USB mode
adb usb
restarting in USB mode
Help me
These are commands for the shell of the android device, not for the host system.
Type adb shell to get the device's shell and then enter them. If you get back to the windows shell prompt you are in the wrong place.
However those commands may not be effective on a secured device anyway.
setprop is an Android command and is meant to be used in a terminal after su on the device (you can do adb shell setprop ... but when you adb shell stop adbd you'll loose your device connection). The easier way if already connected via USB is adb tcpip 8600 and then adb connect IP_OF_PHONE:8600 -- but this will only work if adb shell will get you a root prompt (starts with # and not $). Be aware that anyone on your wifi network can access your device!