72

It seems that wireless ADB has more and more issues each time I update Android Studio. Using 2.1.1, I'm now unable to connect to my tablet using the command:

adb connect <ip addr>

It results in the error:

unable to connect to <ip addr>:5555: cannot connect to <ip addr>:5555: No connection could be made because the target machine actively refused it. (10061)

This happens directly after approving the connection in the dialog box on the tablet. Before today I was forced to do an adb kill-server prior to attempting to connect to the tablet but now that doesn't even help.

Luke Allison
  • 3,118
  • 3
  • 24
  • 40

34 Answers34

142

Generally you can say this error is network related, check these items first:

  • make sure your computer and your device can see each other in network mostly this means they are connected to the same router, but in more advanced scenarios your device may be connected to a wireless router and you computer may be connected to you Local Area Network. what is important is they can see each other. you can check this by pinging you device ip address from you computer.

  • make sure there is no conflict with ip addresses, this might be very simple. but if you do not use DHCP server and you enter the ip addresses in you devices you could mistakenly entered same ip address in different devices

when you are sure about the network issues redo the famous steps

So when you connected by USB follow these commands:

  1. stay connect via USB

  2. connect to your WIFI network (computer and mobile device both)

  3. ping DeviceIP (must be have ping to your device)

  4. adb kill-server

  5. adb usb

  6. adb tcpip 5555

    1. unplug usb cable (as per @captain_majid 's comment)
  7. adb connect yourDeviceIP

  8. adb devices (must be see two device names , one of them is by deviceIP)

  9. unplug USB cable

Steps from could not connect to tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)

Lii
  • 11,553
  • 8
  • 64
  • 88
Muhammad Naderi
  • 3,090
  • 3
  • 24
  • 37
42

when restart device then your port also channge so hit command below

1- adb kill-server

2- connect your phone to pc with usb cable

3- adb tcpip 5555

4- adb connect (your device ip):5555

rushikeshmore
  • 542
  • 4
  • 7
24

Device and PC are connected to same network connection.

1 stay connect via USB

2 adb kill-server

3 adb usb

4 adb tcpip 5555

5 adb connect 192.168.43.1:5555

6 adb devices (must be see two device names , one of them is by deviceIP)

7 unplug USB cable

Rahul Patel
  • 291
  • 3
  • 4
14

I had the same issue. These steps worked for me:

  1. connect your device with usb
  2. when your cmd already in AppData\Local\Android\Sdk\platform-tools>,type adb tcpip 5555
  3. the cmd will show restarting in TCP mode port: 5555
  4. type adb connect 192.168.43.1:5555

Hope this can solve your issue.

stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
Yudirius
  • 141
  • 1
  • 2
9

I recently faced the same problem. It occurs because your device and PC are connected to different Networks.

Tanja
  • 41
  • 2
  • 3
  • 11
Hardy Android
  • 855
  • 9
  • 20
  • 1
    This is strange. I have never had this issue before today. I pulled out the network cable and connected to the network wirelessly instead and it made a connection to the tablet. – Luke Allison May 17 '16 at 05:18
  • 32
    No, both are on the same network. It just stops working on a day to day basis for unknown reasons. – Zackline Dec 07 '17 at 12:03
  • 1
    I'm having this issue. I am definitely on the same network because I can hit a web page on my machine. I'm guessing this is a firewall problem. – Christian Findlay Feb 25 '18 at 07:21
  • @ Melbourne Developer I don't think it's a firewall issue. if you still face the same issue then refer: http://codetheory.in/android-debug-bridge-adb-wireless-debugging-over-wi-fi/ – Hardy Android Mar 08 '18 at 05:27
  • 3
    Wrong, both devices arr on the same subnet and it still saying no remote devices found – alex_z Dec 04 '18 at 09:06
  • i pinged my mobile from computer and i got successul reply also my laptop is connect through my mobile – Vikas Kandari Mar 15 '20 at 16:55
  • No, both are on the same network. It just stops working as the phone restarted and should be initialized again. – HoseinGhanbari Aug 22 '21 at 14:50
6

when restart device then your port also channge so hit command below

1- adb kill-server

2- adb tcpip 5555

3- adb connect (your device ip):5555

Kostas Drak
  • 3,222
  • 6
  • 28
  • 60
5

I got this error when I had Bluestacks emulator started together with my phone attached. When I typed in command prompt adb devices I could see two devices:

adb devices
List of devices attached
dfdcdc9c        device
emulator-5554   device

Before typing adb connect I had to type -s and device ID:

adb -s dfdcdc9c tcpip 5555
adb -s dfdcdc9c connect <ip addr>
axilos
  • 121
  • 1
  • 2
4

In case of me, i tried different port 5557 than again 5555,

  1. adb tcpip 5557
  2. adb connect device_ip_address

gives same error(10061) than again tried with,

  1. adb tcpip 5555
  2. adb connect device_ip_address

result: connected

that works for me(while the other thing is ok like as developer option is on and connected to same wifi)

Bashir Fardoush
  • 184
  • 1
  • 10
4
Make sure you have to connect your phone through a USB cable for the first time.
Using Command prompt, Go to your Android SDK Directory (sdk->Platform-tools) and then 
run the following commands
1-  adb kill-server
2-  adb tcpip 5555
3-  adb connect 192.168.1.130 (Replace IP Address with your phone IP)
4-  Now you can unplug it.
5-  Then go to the Android studio and choose the device with IP address in 
    Run 
    Dropdown. Hope this will help it for everyone.
   And then for next times just runs following command
   adb connect 192.168.1.130:5555

 Note: If Device is not showing in Android studio devices dropdown then 
       connect **USB** and run following commands
 1-adb kill-server
 2-adb usb
 3-adb tcpip 5555
 4-adb connect 192.168.1.130:5555
Abdul Mateen
  • 1,139
  • 1
  • 14
  • 21
4

You must connect the mobile device via USB first, then type adb tcpip 5555 , and then enter your device IP adb connect <your_device_ip>

Praveen Aanand
  • 125
  • 2
  • 6
4

For anyone who is Android 11+

  1. Enable Developer Options
  2. Enable Wireless Debugging
  3. Allow wireless debugging on this network.
  4. Pair Device with Pairing code
  5. Type in adb pair [Phone_IPAddress]:[PORT] [PAIRING CODE]
  6. After Successfully Pairing. Type adb connect [Phone_IPAddress]:[PORT]

For more info: ADB Documentation

3

I solved the problem by enabling USB Debugging in Developer Options.

2

Unfortunately this issue can be caused by different reasons. One of the reasons - make sure previous communication is disconnected.

USE:
1. adb kill-server
2. Issue command adb disconnect after restarting adb server. Do same thing after finishing job
3. run adb remount
4. adb tcpip 50555 (I usually use higher port number)
5. unplug USB cable
6. adb connect device_ip:50555

when done run adb disconnect

sorak
  • 2,607
  • 2
  • 16
  • 24
999masks
  • 41
  • 1
2

Following steps are standard ones to follow( mostly same as previous answers):-

  • adb tcpip 5555.
  • adb connect your_device_ip_address.
  • adb devices (to see if devices got connected).

But in some cases above steps gives error like "unable to connect to device. Make sure that your computer and your device are connected to the same WiFi network." And you notice the devices are already on the same network.

In this case, install this plugin "Wifi ADB Ultimate" and follow below steps.

  1. Connect the device once through USB.
  2. Refresh the list to check whether its connected.
  3. Go to About Phone > Status > IP Address and note your IP address(e.g. 198.162.0.105).
  4. Come back to Android Studio and fill in this IP as done in below photo and hit the run button. enter image description here
2

I had same issue with Android Studio 3.5.2, here is how i solved it.

  1. First you must connect your device via USB once. (Debugging mode starts only when usb is connected)

  2. Go to command prompt : adb tcpip 5555 (watch for port on which adb started) then : adb connect :

  3. After successful connection goto Studio>Run>Select Device.

Brown
  • 21
  • 1
2

I assume you already solved the problem by now. but here is the way to avoid the problem if you are using multiple devices. I used to have the same issue so many times until I understand, how it works. I was also trying to connect multiple devices one after another or trying to connect the same device after a while.

Always make sure to disconnect the older device before you connect the new device:

adb disconnect

after that, you will be easily able to connect new device:

 adb tcpip 5555
 adb connect <your_device_ip>

you can always try to ping the device using the ping command, if the ping is not getting acknowledgment then you must have connected to different wifi then your laptop or you haven't connected to wifi at all:

ping <your_device_ip>
patel dhruval
  • 1,002
  • 10
  • 12
1

Usually the 'target machine actively refused it' message is displayed when the target machine's 'ADB debugging' feature is not turned ON. It is turned off by default in almost all devices unless we enable 'developer options'. So whenever you land on this error, make sure you go to the settings of your target machine and trickle to the developer/development area and somewhere there should be a place to enable ADB.

johnmanoahs
  • 71
  • 1
  • 1
  • 7
1

After weeks of struggle and trying different approaches while everything was right and on the same network (ping {ip} was coming back positive) I figured the dumb debug bridge does not look for all network adapters to find the device! The device got connected when I manually disabled all other network adapters except the one (WiFi adapter) which was required to connect.

Sdghasemi
  • 5,370
  • 1
  • 34
  • 42
1

Step 1. Type command in terminal adb tcpip 5555

Step 2. Type command in terminal adb connect <your_phone_ip>:5555

Now check in studio device Monitor tool your phone connected without wire.

Note :- Most important your Laptop & Mobile Device Connected with same Network

Manoj Rawat
  • 260
  • 4
  • 6
1

I had the same issue and I thought it might be because of the network and tried many solutions but didn't work. Lastly, I checked my IP address which was updated for my device and was the root cause for this.

So please check the IP address first and use adb tcpip <port> to start listening the connection and adb connect <IP>:<PORT>

enter image description here

Minion
  • 964
  • 14
  • 16
1

Try this way change adb to .\adb

PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb kill-server
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb usb
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb tcpip 5555
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb connect 192.168.1.34:5555

connected to 192.168.1.34:5555
Mori
  • 2,653
  • 18
  • 24
0

I had a similar problem. I found out the problem was if I had other devices/emulators connected to the adb already, the "adb connect <ip_addr>" command would give me the "No connection could be made because the target machine actively refused it" message.

The solution is to make sure all the other devices/emulators are disconnected (either physically disconnect or quit the emulator application) before running adb connect <ip_addr>. You can then reconnect your other devices (if you need them reconnected). A total pain.

Your mileage to this solution may vary depending on your problem.

ONE
  • 567
  • 7
  • 15
0

I got this error when trying to establish an ADB connection to a smartwatch with WearOS 1.0 (Huawei Watch 2) via WiFi. Enabling the menu entry for fixing some WLAN issue ("Fix error via WLAN" -- my own rough translation of the German caption "Fehler über WLAN beheben") in the "Developer options" on the WearOS device solved the issue for me.

user1364368
  • 1,474
  • 1
  • 16
  • 22
0

I had the same issue. It was working perfectly for a month, and then one day it stopped working. I tried all the solutions above, but to no avail. Then, I noticed that for some reason, the IP address of my phone had changed, ending with the number 1 instead of 0. So I connected to the new address with 1 as the last digit in the address and now it works again. Weird.

bran
  • 33
  • 1
  • 6
0

In my case I played with my device long enough to somehow mess up adb deamon, so port number was not set up correctly anymore.

getprop service.adb.tcp.port returned empty string.

So I solved this with following commands:

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

I ran all commands on rooted device in app that emulates command prompt.

Brontes
  • 134
  • 5
0

So I came here because I want to adb shell into my physical Android phone over the network. Lots of useful answers are provided, but the most obvious fact is never stated. Here is the #0 fact:

  • The Android phone should ALWAYS be connected via USB to the laptop
  • And then another different laptop will do adb connect ...

This was not what I had in mind and all the above answers never mentioned it.

daparic
  • 3,794
  • 2
  • 36
  • 38
0

Go to Android Studio File - Settings enter image description here Next..

enter image description here

Happy Codding :)

Sahil Choudhary
  • 181
  • 1
  • 7
0

I had a problem with my Huawei. For some reason I had wrong drivers, on Device Manager it was showed like "Android Phone". Then, I updated the drivers from Device Manager, I choose another driver and now it is showed as "Huawei" device.

enter image description here

From there I connected my device whitout problem (adb connect IP:5555)

Mike Aguilar
  • 348
  • 2
  • 3
  • 14
0

For Android TV, Connect PC and TV in the same network (wi-fi), enable developer option, and go to developer option and enable ADB debugging option.Then run the commands given below

 1. ping <ur IP> (check the connection)
 2. adb disconnect (to remove all the previous connections)
 3. adb connect <Ur IP>
 4. adb install app_name.apk
V A S
  • 3,338
  • 4
  • 33
  • 39
0

I have attempted to use many solutions above to no avail and found some pretty simple solution that works for myself.

If you are using a real device to debug like me, you may check the device official website to download the android USB driver for your development environment.

I'm using Samsung phone to debug and using windows as development environment thus I went here, download the Android USB Drivers for Windows and run it.

It resolves my ADB problem.

0

In my case my device is ping-able also but couldn't connect using adb connect syntax. so, i just simply turned on flight mode on both laptop and smartphone and voila it worked.

Before:>adb connect 25.161.247.230 cannot connect to 25.161.247.230:5555: No connection could be made because the target machine actively refused it. (10061)

After:adb connect 26.165.124.26 connected to 26.165.124.26:5555

0

In my case, it was just the wrong android device IP address. I fixed it by looking for it in the settings.

Piyush
  • 693
  • 1
  • 7
  • 12
0

Check Mobile IP then

adb connect <IP>:5555

ckeck also in Developer Options make sure disable adb authorization timeout it's on ايقاف مهلة تفويض أداة adb disable adb authorization timeout

ايقاف مهلة تفويض أداة adb

مصطفى
  • 555
  • 4
  • 9
-2

I resolve the problem like that :

  • on Android device activate the developer mode (Setting->Device->Build 7 time)
  • In developer mode activate debugging mode
  • then adb connect xx.xx.xx.xx
  • then a windows appear in android, click accept the connexion

Michael