30

I am having trouble enabling wireless debugging in Android Studio. In fact when I select "Pair Devices using Wi-Fi", I get an almost instant error with the very general (useless) message "unexpected error during Wi-Fi pairing initialization". I was very surprised being that I was unable to find any posts or pages when googling for that specific message!

Android Studio provides a "learn more" link that opens up this page and is basically useless—it describes basic steps which I will copy below. I can't find any logs or more specific error messages. I tried rebooting the PC, restarting Android Studio, turning off any firewalls/anti virus, trying with phone plugged in (USB debugging works fine, I can load apps to the phone when plugged in no problem), ADB restart, updated Android Studio and SDK platform tools. Nothing changes; it is the same message (see the screenshot at the bottom).

What bugs me is that because the error message pops up almost instantly, the whole "service" seems to be unable to start completely. I have researched extensively, but most errors are quite specific and deal with network/IP issues or pairing problems, etc.—but all those are after some initial steps do take place.

I am running Android Studio 15 (Dolphin) | 2021.3.1.

I have a Samsung s21FE running Android 12 (although I don't think that is even relevant, it never starts looking for devices anyway).

I have followed all steps in relevant guides, for example here, namely:

  1. Ensure that your workstation and device are connected to the same wireless network.
  2. Ensure that your device is running Android 11 or higher. For more information, see Check & update your Android version.
  3. Ensure that you have Android Studio Bumblebee (2021.1.1). You can download it here.
  4. On your workstation, update to the latest version of the SDK Platform-Tools.

The error I see is this:

Enter image description here


I solved it by following a suggestion from the comments submitted on this post. See below.

10
  • 1
    Have you tried pairing your device using adb from terminal using "adb pair your_ip:your_port" ? Commented Sep 15, 2022 at 20:27
  • directly on wifi you mean, or while usb connected? Commented Sep 15, 2022 at 20:28
  • While connected on wifi Commented Sep 15, 2022 at 20:29
  • i will try and report what happened. thanks. Commented Sep 15, 2022 at 20:30
  • 1
    If you re connected with your device now you should be able to use it to run the app Commented Sep 15, 2022 at 20:39

9 Answers 9

44

Try upgrading the SDK Platform tools in menu ToolsSDK ManagerSDK Tools.

SDK manager

Sign up to request clarification or add additional context in comments.

2 Comments

That fixed the issue, somehow I had no Platform-Tools installed.
I had my device constantly reconnecting (disconnecting and connecting every few seconds) when connected through USB debugging. Updating Platform-Tools helped me too.
12

I had to:

  • Hold "Wireless Debugging" on the device to be able to see "Pair device with pairing code". Wireless Debugging Screen
  • On windows host (where Android Studio is), then use adb pair [ip.address]:[port displayed on device] Pair Device w/ Pairing code Screen
  • Enter code in shell shown on device
  • In shell, then enter adb connect [ip.address]:[port listed in Wireless debugging] - This is different than the previous port used and is shown in the main section of Wireless Debugging Device IP/Port
  • After connection, use adb shell to test or go directly to Android Studio and the device is listed in "Device Manager"

Comments

8

I have fixed this problem by closing Android Studio and opening it again.

Comments

7

It worked for me by killing adb.exe from Task Manager.

Task Manager > Processes > Apps > Android Studio > adb.exe

AND

Task Manager > Details > adb.exe

1 Comment

Thanks! Once latest SDK and SDK Tools and SDK Platform-tools installed, just kill the adb.exe and attempt to do pairing worked.
3

I have fixed this problem by restarting the PC.

Comments

1

I had the same issue being within a corporate VPN on Windows.

I solved it following below steps (of which some might be optinal):

  1. Pair the Device and Windows Computer over Bluetooth
  2. On Windows: Enter a Personal Area Network (using the small bluetooth icon in the taskbar)
  3. In the following window, select the Phone, and choose "Connect via" and then "Direct connection" (i hope the translation is correct here)
  4. Android: Enable Wireless debugging
  5. Select "Pair device with pairing code"
  6. A window pops up telling you IP-address, [paring port] & [pairing code]
  7. If your IP address shows as 10.1.10.1, find your device's [real ip address] in the device's WiFi settings, otherwise, use the shown address as [real ip address]
  8. Windows: Open a terminal and enter .\adb pair [real ip address]:[pairing port]
  9. If prompted for the pairing code, enter it
  10. On the device in the Wireless Debugging Settings Window, note the different [connect port] under "IP address & Port"
  11. On windows in the terminal, enter .\adb connect [real ip address]:[connect port]
  12. After a while, IDEA should now dected and show the device in device manager > physical devices

Comments

1

Use ADB wifi plugin for wireless debugging.

enter image description here

Comments

1

Please ensure you are running Android Studio as an Administrator on Windows, and that adb.exe does indeed have the correct firewall permissions.

Comments

0

I fixed it by downloading the latest SDK platform here the link. https://developer.android.com/tools/releases/platform-tools After download go to file manager >localdisk C>Users>name>AppData>Local>Android>Sdk paste the new downloaded platform-tools

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.