Search code examples
androidusb-debugging

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


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.


Solution

  • 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