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
Try disabling and then re-enabling adb mDNS from android studio settings.
Fix 2
Try disabling any (virtual) network adapters for VPNs or VMs (virtual machines).
These steps are for Windows, there maybe a Mac equivalent of this so try that, and if Macs do not have virtual adapters. Try the next fix.
You can enter this path (Control Panel\Network and Internet\Network Connections
) in your top bar of the Control Panel, otherwise just follow these steps:
Go to "Control Panel" in Windows
Click on "Network and Internet"
Click on "Network and Sharing Center"
Click on "Change adapter settings"
Right-mouse click on any adapter you wish to disable
After these changes, check your Android Studio to see if disabling the adapter solved your problem.
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.