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.
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:
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:
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?
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.
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#L966adb_main
to open a TCP/IP socket connection.In older branches the logic for identifying the privileges of
adbd
were inadb_main
itself. See: https://github.com/android/platform_system_core/blob/froyo-release/adb/adb.c#L860So, to further prove that
adbd
won't enter TCP/IP mode (even thoughadb tcpip
gives out no errors), look at the following:adb shell getprop | grep 'ro.secure\|debuggable\|qemu'
, output for my device:This does not meet the conditions of being able to get a
secure
value of 0 inadbd
, 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 thetcpip
command as expected from anadbd
running in TCP/IP mode.Hope this helps, good luck!
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.