adb connection over tcp not working now
Asked Answered
L

15

95

I was trying to use adb over TCP/IP. I have followed these steps

adb tcpip 5555

adb connect 194.68.0.100:5555

I have used my device for 2 days and now I am unable to connect to my IP address like when I do

adb tcpip 5555

it doesn't respond anything. Anyone knows what could be the scenario.

Loraine answered 21/9, 2013 at 7:24 Comment(0)
D
79

Try to do port forwarding,

adb forward tcp:<PC port> tcp:<device port>.

like:

adb forward tcp:5555 tcp:5555.

sounds like 5555 port is captured so use other one. As I know 7612 is empty

[Edit]

C:\Users\m>adb forward tcp:7612 tcp:7612

C:\Users\m>adb tcpip 7612
restarting in TCP mode port: 7612

C:\Users\m>adb connect 192.168.1.12
connected to 192.168.1.12:7612

Be sure that you connect to the right IP address. (You can download Network Info 2 to check your IP)

Doall answered 21/9, 2013 at 7:41 Comment(11)
i am using adb forward tcp:5555 tcp:7612 and then adb connect 194.68.0.100 and then i get unable to connect 194.68.0.100:5555Loraine
did you try 194.68.0.100:7612?Doall
unable to connect 194.68.0.100:7612:7612, this is the output that i getLoraine
see my edit, for me it works, i used the same port. I think you have problem with routing table on your device, try to on/off WiFi. BTW, for usb you may use 127.0.0.1Doall
actually 1st option worked my ip just got changed i just din't confirmed that, are tere any other free ports availabe like if in future this port also causes some troubleLoraine
I have automation and use only 7612 for PC and android during 2-3 years on 3-5 devices. Never got them busy, you have 65k ports :)Doall
can we permanently connect device with adb like paring devices, actually every time i start machine i have to manually connect it with this commandLoraine
if you run Emulator - I don't know, on real device run port forward only if you unplugged USB cable.Doall
My device is creating trouble again sometimes it connects normally and sometimes at both the ports 5555 , 7612 it says its unable to connect, I have also checked if my ports are busy using netstat -ano|grep 7612 but they are not, any idea what's wrong hereLoraine
Device and development computer should be in the same network.Ready
I used adb forward tcp:5554 tcp:5554 and it works for me!Wintry
A
193

This answer is late, but hopefully it helps others.

I have had the same experience of not being able to connect. Rebooting phone and PC does not help. I found the fix at: http://developer.android.com/tools/help/adb.html at the bottom of the page.

Basically you follow these steps:

  1. Connect phone with usb cable to PC.
  2. Issue command: adb usb
  3. Issue command: adb tcpip 5555
  4. Issue command: adb connect xxx.xxx.xxx.xxx

Where xxx.xxx.xxx.xxx is your phone's IP address.

Aarika answered 22/7, 2014 at 13:44 Comment(3)
Not always works, other times you need to pick the kill-server answer.Confect
This worked for me thanks. Couldnt get ADB to connect to manually install the Dec Android 12 update.Cramfull
Mentioning your phone's IP address is what did the trick for me, as I was using the phone-cable-connected remote machine's IP insteadFenelia
D
79

Try to do port forwarding,

adb forward tcp:<PC port> tcp:<device port>.

like:

adb forward tcp:5555 tcp:5555.

sounds like 5555 port is captured so use other one. As I know 7612 is empty

[Edit]

C:\Users\m>adb forward tcp:7612 tcp:7612

C:\Users\m>adb tcpip 7612
restarting in TCP mode port: 7612

C:\Users\m>adb connect 192.168.1.12
connected to 192.168.1.12:7612

Be sure that you connect to the right IP address. (You can download Network Info 2 to check your IP)

Doall answered 21/9, 2013 at 7:41 Comment(11)
i am using adb forward tcp:5555 tcp:7612 and then adb connect 194.68.0.100 and then i get unable to connect 194.68.0.100:5555Loraine
did you try 194.68.0.100:7612?Doall
unable to connect 194.68.0.100:7612:7612, this is the output that i getLoraine
see my edit, for me it works, i used the same port. I think you have problem with routing table on your device, try to on/off WiFi. BTW, for usb you may use 127.0.0.1Doall
actually 1st option worked my ip just got changed i just din't confirmed that, are tere any other free ports availabe like if in future this port also causes some troubleLoraine
I have automation and use only 7612 for PC and android during 2-3 years on 3-5 devices. Never got them busy, you have 65k ports :)Doall
can we permanently connect device with adb like paring devices, actually every time i start machine i have to manually connect it with this commandLoraine
if you run Emulator - I don't know, on real device run port forward only if you unplugged USB cable.Doall
My device is creating trouble again sometimes it connects normally and sometimes at both the ports 5555 , 7612 it says its unable to connect, I have also checked if my ports are busy using netstat -ano|grep 7612 but they are not, any idea what's wrong hereLoraine
Device and development computer should be in the same network.Ready
I used adb forward tcp:5554 tcp:5554 and it works for me!Wintry
A
41

Step 1 . Go to Androidsdk\platform-tools on PC/Laptop

Step 2 :

Connect your device via USB and run:

adb kill-server

then run

adb tcpip 5555

you will see below message...

daemon not running. starting it now on port 5037 * daemon started successfully * restarting in TCP mode port: 5555

Step3:

Now open new CMD window,

Go to Androidsdk\platform-tools

Now run

adb connect xx.xx.xx.xx:5555 (xx.xx.xx.xx is device IP)

Step4: Disconnect your device from USB and it will work as if connected from your Android studio.

Antlia answered 14/9, 2015 at 7:43 Comment(0)
E
18

Just a tiny update with built-in wireless debugging in Android 11:

  • Go to Developer options > Wireless debugging
  • Enable > allow
  • Pair device with pairing code, a new port and pairing code generated and shown
  • adb pair [IP_ADDRESS]:[PORT] and type pairing code.
  • done
Enemy answered 10/9, 2020 at 16:12 Comment(0)
W
13

I couldn't do it on a Galaxy S3 (non rooted).

For me it would hang saying...

restaring in tcp mode

So i found this series of commands quite useful.

First disconnect your device, start from scratch (cmd in admin mode and all the stuff).

connect your device and write in CMD/Terminal:

adb kill-server

control should return as normal. Now type and enter

adb tcpip 5555

you will see..

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully * restarting in TCP mode port: 5555

and then connect device with

adb connect <IP>

That's how it worked for me after a lot of hassle!

UPDATE FOR ANDROID STUDIO

I noticed this doesn't work sometimes, even after correctly repeating steps a number of times. Catch was; sometimes ADB is yet not initialized by Studio unless, Android Tab at the bottom is opened and you see "Initializing Android Studio".

You will large Initializing text.

Wiseacre answered 18/3, 2015 at 6:31 Comment(1)
I am working on Ubuntu and changing the the tcpip address solved the problem. I additionally configured Genymotion to point to the Android Studio SDK. Now I am able to access my emulators.Islamite
L
6

if you use Android M:

Step 1 : adb usb
Step 2 : adb devices
Step 3 :adb tcpip 5556
Go to Settings -> About phone/tablet -> Status -> IP address.
Step 4 : adb connect ADDRESS IP OF YOUR PHONE:5556

Lovmilla answered 18/10, 2016 at 7:40 Comment(0)
U
6

Just Try to Debug Mode ON or OFF and then try to reconnect it.

if it dosn't work then connect with USB and try following command in terminal

adb tcpip 5555

and now try with connection command

adb connect Your Phone IP:5555

Umbelliferous answered 26/9, 2020 at 3:51 Comment(0)
G
4

maybe your vpn is enabled, try to disable VPN

adb kill-server
adb tcpip 5555
adb connect xxx.xxx.xxx.xxx:5555
Gale answered 11/6, 2021 at 3:15 Comment(0)
O
2

I solved that issue follow that:

Steps:

  1. Make sure that Aggressive Wi-Fi to Cellular handover under Networking section in the device's developer options is turned off.
  2. Ping continuously from your pc to the device to make sure it's not in network idle mode ping -t 194.68.0.100 (windows cmd), unlock the device and even try to surf to some website just to make it get out of the network idle.
  3. If ping doesn't work, turn off / on Android Wifi and go back to step 2.
  4. When it replies to the ping, connect it via USB, and:

    adb usb

    adb tcpip 5555

    adb connect 194.68.0.100:5555

In casr it's still not connected, try to switch the usb connection mode as MTP / PTP / Camera while the device is connected through usb and repeat these steps over again...

Octagonal answered 29/5, 2018 at 4:35 Comment(1)
try to switch the usb connection mode as MTP / PTP / Camera while the device is connected through usb That what did the trick in my case. After adb connect while the phone and the computer were physically connected via the cable, the wireless connection i detached the cable which dropped the wireless connection, but was regained by toggling the MTP or file transfer mode back and forth.Fenelia
F
1

Tried EVERYTHING here and more, and nothing worked for me. Then I finally realised my VPN was blocking sharing the connection with other devices on the network. Disabling that everything finally started working.

Fondea answered 20/9, 2022 at 8:52 Comment(0)
E
1

The solution that worked for me :

  1. I connected my phone to my pc using usb and enabled usb debugging in developers options.
  2. Once my device got pc's fringerprint,from next time i could just connect using adb connect <mydeviceip>:<port>

It suddenly stopped working bucause i had deleted my pc from list of conected devices inside wireless debugging options.

Eteocles answered 18/9, 2023 at 16:5 Comment(0)
C
0

Thanks to sud007 for this answer. In my case, I only need this part of the solution:

In CMD/Terminal:

$ adb kill-server

$ adb tcpip 5555
restarting in TCP mode port: 5555

$ adb connect 192.168.XXX.XXX

This bug brings more errors than unable to connect to 192.168.XXX.XXX:5555: Connection refused. In my case, I could connect to the device, but when you try to run the app. AndroidStudio stay in Installing APK forever. In this case, I needed to restart the phone too.

Confect answered 25/4, 2018 at 8:3 Comment(0)
C
0

ADb used to work fine for me for a week. But now suddenly today it says the machine actively refused connection.

fix:

step 1: go check you phone's IP Adress once again, it keeps changing.
step 2: If it changed. Just use that new IP to connect.

Hope it helped someone :)

Concomitance answered 17/8, 2020 at 5:40 Comment(0)
S
0

another thing to try :-

From adb over usb try :

su
setprop service.adb.tcp.port 5555
stop adbd

then go to settings>dev options>

disable then re-enable developer options and usb debugging

this worked for me

then you can continue with old fashioned way to connect :-

adb connect xx.xx.xx.xx:5555 (xx.xx.xx.xx is device IP)

credits

Snowfield answered 28/8, 2022 at 16:37 Comment(0)
A
0

In macos, close all the emulators first. Then type these in order:

adb kill-server
adb tcpip 5555
adb connect *DEVICE_IP*:5555
Animadversion answered 10/10, 2023 at 17:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.