Wi-Fi Debug (ADB) - There was an error pairing the device
Asked Answered
L

12

38

When I first update to new version of studio I tried to use this new WiFi debug feature and it was working at first time (using QR code or manually typing the code) but now it's stuck with "Connecting to device. This takes up to 2 minutes." message for some time and then I get "There was an error pairing the device" message. Before it would take a couple of seconds to connect. My device is Samsung S10 (12 Android)

enter image description here

Update:

Using real MAC for the current Wi-Fi network on Android devices doesn't really solves the issue:

enter image description here

Mb it helps in some cases, but after I tested it for a while it still can't connect from time to time so I have to manually open Wireless Debug screen on a Android device and check ip:port to enter manually adb connect ip:port in Terminal.

IPs of devices never change. I set static for all devices in router's settings. It also doesn't help.

So for now none of these solutions solves the issue for good.

I still have to call the following in Terminal:

adb kill-server
net stop winnat
net start winnat
adb start-server

(net * winnat - For windows)

Then switch Wi-Fi on the device to make it work again.

So I can't accept the answer yet, though some answers may help in some cases (but we need a 100% solution)

Lodgment answered 22/2, 2022 at 12:9 Comment(6)
I'm having the same issue this morning... did you find a solution?Laurenalaurence
i have the same device and the same problem. Hope there is a solution.Piezoelectricity
Same problem on samsung device, but after I switch off and on wireless debugging again it connected.Dupondius
@DonMadrino https://mcmap.net/q/275782/-wi-fi-debug-adb-there-was-an-error-pairing-the-deviceLodgment
@Piezoelectricity https://mcmap.net/q/275782/-wi-fi-debug-adb-there-was-an-error-pairing-the-deviceLodgment
Simplest solution: https://mcmap.net/q/273011/-android-studio-bumblebee-pair-wifi-not-workingArzola
G
55

I was able to resolve the issue from within Wi-Fi settings by disabling the Randomized MAC Address feature under Privacy. Using my device's actual MAC address fixes the issue.

Android Wi-Fi Settings

Galliard answered 4/8, 2022 at 22:28 Comment(5)
This worked for me. Randomized MAC was problem.Lading
This didn't work for meKamasutra
yeah, I guess it makes a lot of sense, will test it and accept your answer later if everything is goodLodgment
Cheers, as of April 2024, this fixed the issue.Athematic
I have real MAC now on all my test devices, and it doesn't help. So I can not accept it as the solutionLodgment
Y
40

EDIT 3: A lot of people have reported that toggling Developer Settings work as well.Also ensure that you're not connected to the VPN, since tunneling is affected
EDIT 2: Take a look at the below answers, the actual reason seems to be that the device is assigned a random IP or a MAC via DHCP, if you can disable that via system settings for your specific custom ROM, then it's even better

EDIT: If you see regular disconnections, click on `Pair Device with Pairing Code`, and then pair your device with the following command
adb pair <ip-addr>:<port> <pairing_code>

I was facing the same issue, what I did was switching to the command line way of connecting with the device. You can do so in the following way

  1. Make sure USB Debugging is enabled on the device you intend to connect with
  2. In your device, go to Developer Settings>Wireless Debugging and you will see something like so

Sample Screenshot

  1. Now carefully look at the IP ADDRESS AND PORT section and type the following in the terminal
  adb connect <ip-addr>:<port>

And your computer will show under paired devices like the above screenshot

Yankee answered 4/3, 2022 at 6:53 Comment(6)
The second way does not work. I get "no route to host" and tcpip throws an error saying their are no devices.Hyohyoid
First way failed saying Unable to start pairing clientHyohyoid
"Make sure USB Debugging is enabled on the device you intend to connect with" is important ... even though you are using Wireless debugging, if USB debugging is not on, it just doesn't work.Gathering
Restarting the Android device fixed "Unable to start pairing" this issue for meAlsatian
Even worse, I get the following message in the terminal, "adb : The term 'adb' is not recognized as the name of a cmdlet, function, script file, or operable program."Mutule
basically it's not a solution but just another method to connect when first one fails, eventually it may temporary fix the normal way but after some time it will fail again and need to do all that stuff againLodgment
S
8

I had the same problem but I managed to find the solution. You have to follow the following steps:

  1. In your smartphone (Go to Settings->Developer options-> Wireless Debugging->Pair device with pairing code).
  2. Copy the ipaddress & port. For example: 192.168.1.2:42123 and wifi pairing code: 234321.
  3. Open your terminal and go to the following path: cd %LOCALAPPDATA%/Android/sdk/platform-tools
  4. Paste the following command following this order: adb pair (ipaddress & port that you saw when you clicked on "Pair device with pairing code") adb pair 192.168.1.2:42123
  5. Paste the access code to the wifi connection. Enter pairing code: 41107.
  6. Finally, on the same screen go to the option that says IP address and port and you will see the same address but with another port (You can find it in this part of your screen), copy it and write the following command: adb connect 192.168.1.2:41107

If you see a message like this "connected to 192.168.1.2:41107", you did it you will be able to connect your phone with android studio without any problem.

Sitka answered 26/9, 2022 at 1:15 Comment(1)
What is the difference between your answer and mine?Yankee
I
5

This really helped me

Using Terminal Tool

Pairing: `

  1. enable wireless debugging
  2. click on Pair device with pairing code
  3. in terminal type: adb pair {ip_address}:{port} {pairing_code}
  4. you will see your pc name below Paired devices `

Connecting: `

  1. Note ip and port found above Pair device with QR code [VERY IMPORTANT]
  2. in terminal type: adb connect {ip_address}:{port}
  3. you will see Currently connected below your pc name ,congrats :)

Note: next time you can use Connecting step if your pc already paired

Interne answered 15/7, 2023 at 6:19 Comment(1)
Well it's just a manual way to connect, it works always yeah, but I want just to use Wireless Debug quick settings to automatically connectLodgment
K
5

I am going to give you a age old solution

  1. Turn off Developer Options
  2. Turn On Developer Options
  3. Turn on USB Debugging
  4. Turn On Wireless Debugging
  5. Try to connect with QR Code
  6. Be Happy when you see that turning this off and on still is a solution to many complex problems
Koal answered 13/2 at 15:0 Comment(1)
I do not know why but this just worked for me.Amplification
L
3

I fixed it by manually assigning IP addresses for my smartphone and PC at settings of the router. Basically avoiding DHCP.

Restarted the router.

Cleared old pairing.

Started pairing again and now it works fine all the time, and no need to repeat pairing process, just enabling "Wireless debugging" from notification panel and in couple of seconds the device will be available in Android Studio

So next time just enable "Wireless debugging" and it's ready

enter image description here

I don't know why there the issue with dynamic IPs

p.s.: though I'm not sure if using the same IP address really fixes it (need to test it for sure), so can't accept any answer for now

Lodgment answered 29/6, 2022 at 7:45 Comment(0)
M
3

Note that for me pairing wouldn't work while I was on my VPN. After I paired while off the VPN, I could adb connect ipaddress:port and it worked.

Mercaptide answered 20/1, 2023 at 21:5 Comment(1)
nobody mentioned VPN, well thanks for this one, it solved my issueSubmit
R
1

This worked for me:

  • Tools --> Troubleshoot Device Connections
  • Press Next --> Next
  • Click 'Restart ADB server'
  • Freshly turn ON Wireless Debugging on device and wait for few seconds.
Recipe answered 11/9, 2022 at 13:49 Comment(0)
C
0

enable the USB debugging option in your mobile device and then retry connecting through wireless option, It will work

In my case It worked

Catechist answered 23/9, 2023 at 8:36 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Heti
R
0

I initially got this error as well, but was able to successfully pair successfully after restarting the device.

Rawdon answered 25/1 at 16:35 Comment(0)
T
-1
  • Turn off developer options, then turn them on again.
  • Turn on usb debugging.
  • Turn on wireless debugging.
  • And the problem is solved.
Todtoday answered 11/6 at 7:37 Comment(0)
K
-2

Important reminder and this is what solved my problem.

Devices must be on the same network.

Kyliekylila answered 28/2, 2023 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.