Android Studio wireless ADB error (10061)

蓝咒 提交于 2019-12-29 23:01:14

问题


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:


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




回答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 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)




回答3:


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




回答4:


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.




回答5:


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




回答6:


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




回答7:


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



回答8:


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)




回答9:


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




回答10:


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.



回答11:


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.




回答12:


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.




回答13:


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.




回答14:


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.




回答15:


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.



来源:https://stackoverflow.com/questions/37267335/android-studio-wireless-adb-error-10061

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!