No connection could be made because the target machine actively refused it. (10061)
Asked Answered
T

12

23

I have problems trying to do wireless debugging.

I followed this instruction: https://developer.android.com/studio/command-line/adb#wireless

And it seems that I cannot connect to my phone at step 7 of the article adb connect device_ip_address.

It said cannot connect to 192.168.1.35:5555: No connection could be made because the target machine actively refused it. (10061)

I tried searching for the solution in stackoverflow but the answers do not suit my situation. They said to make sure that I connect to the same network and I'm pretty sure I am connected to the same network. I see my phone is connected to wifi name "Chor" And PC is also connected to the same name. I can even ping phone IP in the command prompt and receive a good response.

Any clues about what could be the issue? The phone I use is Huawei P30 Lite. I'm using Windows 10.

Tamar answered 7/8, 2019 at 20:9 Comment(1)
If anyone is facing this issue after updating to Android Studio Bumblebee (2021.1.1), you can check my answer in another post which may help as this error msg is also relevant to that issue.Borchers
T
13

I have accidentally found the solution now!

It seems to be a phone issue (specifically Huawei phone). It keeps turning off USB debugging mode by itself so what I had to do was to prevent it from turning off USB debugging mode.

I am not clearly sure of what is the exact step that fixed the issue but here's everything I did in Developer options:

  • Revoke USB debugging authorizations
  • Allow ADB debugging in charge only mode (I think this fixed the issue)
  • Turn off Always prompt when connecting to USB
Tamar answered 7/8, 2019 at 20:42 Comment(1)
Omfg, I've had this issue for 8 months now, this finally fixed it!!! Now I can stop nagging my co-worker for his phone for testing, much obliged!Knopp
I
44

that Occurs due to

  1. device is Restarted
  2. device is connected to another computer or computer is debugging another device
  3. turn offing the developer options of device

Follow those Steps to resolve that problem,

  1. Connect your device to PC by USB cable to pc(one time requirement after each restart) and and turn on usb debugging it will connect successfully, allow for connection in device for promoted message.
  2. then type this Command in terminal "adb tcpip 5555"
  3. now remove the USB cable and connect device with pc with wifi
  4. now type this command "adb connect <your_ip>"
  5. you're all done !!
Isometrics answered 18/8, 2020 at 15:0 Comment(3)
Thanks for knowing me, that my device was restarted so it refused all the activities. thanks a lot. May you be more blessed. Thanks Shiva BrotherSulfide
weird that the most voted answer doesn't solve my specific problem. but it helps other people so nvm lolTamar
Note that item 1 on this list needs to be repeated if the phone is restarted. Hardly a one time thing.Mitchelmitchell
T
13

I have accidentally found the solution now!

It seems to be a phone issue (specifically Huawei phone). It keeps turning off USB debugging mode by itself so what I had to do was to prevent it from turning off USB debugging mode.

I am not clearly sure of what is the exact step that fixed the issue but here's everything I did in Developer options:

  • Revoke USB debugging authorizations
  • Allow ADB debugging in charge only mode (I think this fixed the issue)
  • Turn off Always prompt when connecting to USB
Tamar answered 7/8, 2019 at 20:42 Comment(1)
Omfg, I've had this issue for 8 months now, this finally fixed it!!! Now I can stop nagging my co-worker for his phone for testing, much obliged!Knopp
F
5

Seems like there are some bugs with authorization conditions across different manufacturers. To get your target device to trust your computer, you need to go through more than just approving the computer's MAC address.

After some modifications of @off99555's answer, this is the solution for OnePlus 7 T/Pro devices on OxygenOS 10 (Android 10.x). Might be device manufacturer specific:

  1. Revoke USB debugging authorizations
  2. Connect target device via USB
  3. Change USB usage mode to "File Transfer"
  4. Run 'adb connect 192.168.x.x:5555'

The target device should recognize your computer now, and you can unplug USB and use ADB wireless now. Note that if you revoke USB auth in the future, you will have go through these steps again.

Frosting answered 28/12, 2019 at 21:47 Comment(0)
B
2

I'm facing the same issue then I'm restart everything like Phone, Android Studio/VS Code, and restart Computer. then solved.

Some of the commands you can try.

adb tcpip 4568
adb connect <Your device IP>:4568
adb disconnect
adb kill-server
Beggarweed answered 25/12, 2021 at 5:46 Comment(0)
T
2

go to wireless debugging settings on your phone locate the ip&port option and use the port your phone show like so: adb connect 192.168.1.101:39111enter image description here

Tappet answered 17/3, 2023 at 19:28 Comment(1)
This should be the answer, however it needs improvementConner
S
1

I ran into this error message when attempting to debug my Samsung Galaxy watch and it turns out that the Samsung Galaxy watches run on the Tizen OS and are not meant to be connected to Android Studio via adb. In order to develop apps for these devices, you will need to use Tizen Studio and connect to your device via sdb.

Servetnick answered 10/2, 2020 at 18:32 Comment(0)
E
1

Make sure you are using a cable that can transfer data, and that the device appears in the devices list when the cable is connected.

For device list run command:

adb devices

While the device is still connected enter the connecting command, with the IP address from the device wifi settings.

adb connect ip_address

Ecclesiology answered 4/9, 2022 at 7:2 Comment(0)
R
0

As other mentioned about the process you should first clean the path for connection. But try these two important points

1- Change adb to .\adb

.\adb kill-server
.\adb usb
.\adb tcpip 5555
.\adb connect 192.168.1.34:5555

2- Just you can keep one IP and for the next must clean the path!

Points:

1- As you know, we can set the IP address for a real phone in Static

2- If use a real phone by android 11, need to turn on Wireless debugging, then find the IP & Port

Retrieve answered 16/5, 2022 at 22:6 Comment(0)
D
0

check your wifi debugging ip address

developer option -> wifi debugging

Degust answered 18/5, 2022 at 11:7 Comment(0)
S
0

Solved:- Just once connect your mobile with USB and allow the permission pop-up on the mobile screen, and then try to connect on wifi, it will connect.

Santalaceous answered 18/8, 2022 at 9:12 Comment(0)
P
0

going on developer option -> wireless debugging -> ON ;Check IP address and port use that with adb connect or scrcpy --tcpip=192.168.x.x:port

Predisposition answered 19/9, 2023 at 17:3 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Pancreas
E
0

Kill and start ADB

At terminal:

adb kill-server
adb start-server
Eeg answered 13/11, 2023 at 8:44 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.