As a precaution, make sure Developers option and wireless debugging are enabled and you have latest SDK platform tools installed:-
Goto Sdk manager > SDK Platforms > check "show package details" (at bottom right corner.)
Expand the latest stable Android release (currently Tiramisu) > and check Android SDK platform (currently 33) if not already checked/ installed.
Hit apply and allow the installation to complete if needed.
Fix 1
In Android Studio, File -> Settings
Build, Execution, Deployment -> Debugger
Under Android Debug Bridge (adb), uncheck 'Enable adb mDNS for wireless debugging' and Apply
Wait some seconds for changes to take effect
Recheck 'adb mDNS for wireless debugging' and Apply
On the pop-up window from Windows Defender, allow network access to adb.
Try pairing again, if it doesn't work or you may get An error accoured connecting device... Try the next Fix.
Fix 2
On Windows, some users were able to fix this by disabling virtual network adapters for VPNs or VMs like here Macs "may" have virtual adapters so check that out or skip to next step.
Fix 3
- Goto your
Android/sdk/platform-tools
folder.
For Windows, the default location is: C:\Users\[User]\AppData\Local\Android\Sdk\platform-tools
(but like me you may have moved the folder around, so check that.)
- Open the cmd or Terminal (mac) there.
- In windows you can do this by clicking the folder path in adress-bar of windows explorer, and typing cmd and hitting enter there.
- Alternatively, you can do this by opening terminal anywhere and typing
cd [path to platform-tools directory on your PC]
If your PC appers under PAIRED DEVICES on your android, then skip to
step 6, else
Find your IP address, port number, and pairing code by selecting Pair device with pairing code. Take note of the IP address, port number, and pairing code displayed on the device.
On terminal you opened, run adb pair ipaddr:port
. Use the IP address and port number from above.
When prompted, enter the pairing code, as shown
here
*P.S: these steps are also avilable here from google, but for some reason they didn't mention the steps above.
- After your device is sucessfully paired, run
adb connect ip:port
. the ip:port that is visible in the main page of Wireless debugging here.
With This, hopefully the device will be connected.
Sources
you can check my complete answer here or orignal fixes from orignal finders below. I have edited my answer to avoid it being an exact duplicate, but the thing is no one knows, what is the actual cause and which fix may or may not work, like fix 2 worked for me once, then i messed around and the problem came again.
If any of this helped you, please consider upvoting, I am new here and need some reps to upvote other answers and make comments.