thomas
thomas

Reputation: 472

Problem with Android wireless debugging - "unexpected error during Wi-Fi pairing initialization" - no other info

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.

Upvotes: 27

Views: 16591

Answers (9)

Riaan van Zyl
Riaan van Zyl

Reputation: 627

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

Upvotes: 0

SEROY JOSIEL MARK M
SEROY JOSIEL MARK M

Reputation: 1

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

Upvotes: 0

Harshil Thakkar
Harshil Thakkar

Reputation: 47

Use ADB wifi plugin for wireless debugging.

enter image description here

Upvotes: 1

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

Upvotes: 4

guerillagorilla
guerillagorilla

Reputation: 121

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"

Upvotes: 12

user462982
user462982

Reputation: 1645

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

Upvotes: 1

raphaelmerx
raphaelmerx

Reputation: 724

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

SDK manager

Upvotes: 39

Thong Nguyen
Thong Nguyen

Reputation: 31

I have fixed this problem by restarting the PC.

Upvotes: 3

Rakibul Islam
Rakibul Islam

Reputation: 171

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

Upvotes: 7

Related Questions