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

Viewed 3565

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

4 Answers

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

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

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

This worked for me:

  • Tools --> Troubleshoot Device Connections
  • Press Next --> Next
  • Click 'Restart ADB server'
Related