adb Wi-Fi pairing is infinite - android-studio

Adb Wi-Fi pairing works fine almost all the time. But sometimes I stuck at infinite loading when trying to Wi-Fi pair. After a few minutes it shows the error to try again

Possible solutions
Reboot your phone
Disable and enable Wi-Fi debugging
Disable and enable Wi-Fi
Restart ADB server

Related

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

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)
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
Make sure USB Debugging is enabled on the device you intend to connect with
In your device, go to Developer Settings>Wireless Debugging and you will see something like so
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.
I had the same problem but I managed to find the solution.
You have to follow the following steps:
In your smartphone (Go to Settings->Developer options-> Wireless Debugging->Pair device with pairing code).
Copy the ipaddress & port.
For example: 192.168.1.2:42123
and wifi pairing code: 234321.
Open your terminal and go to the following path:
cd %LOCALAPPDATA%/Android/sdk/platform-tools
Paste the following command following this order:
adb pair (ipaddress & port that you saw when you clicked on "Pair device with pairing code")
abd pair 192.168.1.2:42123
Paste the access code to the wifi connection.
Enter pairing code: 41107.
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.
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
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'
Freshly turn ON Wireless Debugging on device and wait for few seconds.
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.

How do I disconnect all bluetooth devices via command line?

When a specific user logs in on Windows 10, I want to have all Bluetooth devices that are currently connected to be disconnected. How would I do this? I want to be able to automatically enter something in the command line either through the task scheduler, or python. I tried installing Bluetooth command-line tools from bluetoothinstaller.com, but the only thing that I can find that works is to do btpair -u, but that unpairs all the devices instead of disconnecting them.
You can try to toggle the Bluetooth Off and On.
Its not a proper way to disconnect but it works. Try RadioControlCmd! after installing use the following commands to toggle Bluetooth On and Off
radiocontrol.exe Bluetooth On
radiocontrol.exe Bluetooth off

Connect Android Studio and Wear 3.0 smartwatch via wi-fi

ADB debugging needs connection between Android Studio and Wear 3.0 smartwatch (Samsung Galaxy SW 4). How make them work together?
Switch ON Developer Mode on your Smartwatch, including A) Activation Developer Mode in Settings (in most cases push many times on Settings-> About watch -> Software -> Software Version) B) Set ON ADB Debugging C) Set ON Wi-Fi Debugging
Connect work station with Android Studio and smartwatch wear 3.0 to the same wi-fi network
Connect smartwatch via usb charger with workstation (obligatory in most cases at least once)
Send the command in Terminal - adb connect XXX.YYY.Z.A:5555, where XXX.YYY.Z.A - address of your Wi-fi - find it in settings of wifi in smartwatch or workstation
Accept the request on the smartwatch (always allow / always trust);
Check in Studio the change from No Device to your smartwatch.
Notes:
sometimes it's obligatory to turn on \ off ADB Debugging and Wi-Fi Debugging on smartwatch and try again;
sometimes the connection between smartwatch and Studio is working without USB connection at all (but mostly one time and you need to repeat "adb connect XXX.YYY.Z.A:5555";
sometimes you need smartphone in the same Wi Fi network with workstation and smartwatch, sometimes it works well without smartphone.

No USB devices detected in Android Studio 6.0.1

I used to run applications in my Redmi 3s Prime device. Usually it worked, but now it's showing as no USB devices detected.
Developer options and USB debugging is ON, but it is still not detecting. What should I do?
Please check the Android Studio "event log" information.
If the information is like "ADB server didn't ACK * failed to start daemon *", it means that other software holds the port. Referring to this can solve it.
If you cannot find log information, probably it failed to install the driver.
You may disconnect the phone from your computer, restart the mobile phone and try again.
I have a Redmi 3S and that happened to me too. I solved it by installing the correct drivers from here and MI PC Suite and connected the device.
Also in developer options, turn on "Install via USB", "USB debugging" and turn off "Verify apps over USB". If nothing works, try another USB cable or other port.
Restart PC, Restart phone, if no luck,
Try installing usb driver from this link
http://gsmusbdriver.com/xiaomi-redmi-3s
and try again
Download suitable USB Driver, ADB driver and fastboot driver for Xiaomi Redmi 3s Prime from below link and install them on your computer.
https://www.androidusbdrivers.com/xiaomi-redmi-3s-prime-usb-drivers/
After installing restart your computer.

Android 6.0 device not recognized by adb on Linux after reboot

In Samsung Galaxy S6 Edge with Android 6.0, when the device is rebooted, phone complains that the connected computer doesn't recognize the phone and the device is not any more reachable over ADB from the connected Linux PC. The phone in fact instructs user to install proper drivers for Windows or Mac OS, but as the phone is connected to Linux host, there is no help here.
This means, that in order to continue debugging over ADB, one must manually toggle the USB mode from phone from MTP to PTP, after which phone is connected through ADB again. This makes test automation impossible, as the test scheduler needs to reboot the target device between test rounds.
With previous Android versions, rebooting the device remotely and getting ADB connection back was possible, but with Android 6.0, this became a problem. This particular device had earlier Android 5.1 and there were no problems with remote reboots.
As manually toggling of USB mode solves the problem, it might help, if this mode could be automatically toggled after reboot. So far, only solutions I have seen require device rooting and that is out of question.
Does someone have any idea, how Android 6.0 device could be automatically recognized by ADB after reboot?
The solution was after all simple: the Linux user, who starts up the adb server, needed to be added to the "plugdev" group. This group was defined in file /etc/udev/rules.d/51-android.rules with line:
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
With previous Android versions, this didn't seem to be important as we didn't have any users in that group and everything worked fine.

Resources