Android Studio wireless ADB error (10061)

2019-02-02 14:08发布

问题:

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.

回答1:

Recently i face this problem. Because your device and PC connected different Network.



回答2:

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 this 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

6-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)



回答3:

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.



回答4:

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



回答5:

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



回答6:

Because your device will connect diffrent network and you system will connect with diffrent network.



回答7:

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.



回答8:

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.



回答9:

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)



回答10:

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.



回答11:

For Huawei Mate 9, I did everything that people described and nothing worked. I tried all steps. I connected SonyXperia, LG G4, Samsung Galaxy S7 without any problem but Huawei Mate 9 I checked all settings such as USB debugging etc. nothing worked. When I connect the device PC via USB, adb connect ip:port command worked but when I unplug USB cable, I was losing connection and adb connect ip:port did not work and gave the same error in this thread. I gave up! I will go on with other test devices to establish a local grid.