19

I am using the Android Studio Chipmunk edition. My Android device is connected to the WiFi and my PC is connected to the same router through ethernet cable. My devices are running Android 12. So, it seems like I am fulfilling all the requirements.

I was able to connect a few times and able to install apps wirelessly. However, I am failing now. One of the following two things happens each time:

  • The QR scanner does not do anything when I scan the code as if it didn't recognize the QR code at all.
  • The QR code is recognized and I get a message about the pairing taking a while.

I also tried using the six-digit code for pairing by none of my devices are showing up under "Available Wi-fi Devices".

What am I doing wrong?

2
  • Possibly related: the technicality, possible reasons for failing, and possible fixes (disclosure: I wrote the answer).
    – Andrew T.
    Commented Aug 8, 2022 at 13:41
  • I got the same problem here. After getting tired of some other fixes, I just tried to forget the paired device on Phone setting, turn off the wifi on phone, turn on the wifi again, scan the QR and it works :)
    – hungson175
    Commented Dec 14, 2022 at 4:29

7 Answers 7

19

Same happened with me but this fixed the issues:

Run: adb connect <IP address>:<Port> in your terminal whenever your mobile fails to connect.

You can find the IP and port in your phone's settings Settings>Developer Option>Wireless Debugging.

If it gives any error, add a path of your android sdk platform tools in Environment variables [For me it was C:\Users\<username>\AppData\Local\Android\Sdk\platform-tools]

If you can't see AppData folder then turn on the option to view hidden folders from control panel.

In case you don't know how to add a new path in Environment Variable then:

  1. Search Edit environment variables in your Windows search bar and click on the result option.
  2. Click on Path>Edit...>New
  3. Add the path and click Ok > Ok
1
  • 2
    I got an error saying "failed to connect to 192........" Commented May 26, 2023 at 5:40
12

You first need to pair device with:

adb pair IP:PORT

You need to get IP, PORT and the pair code from android Wirelesss debugging menu

NOTE: be careful, the pairing PORT is different from the connect PORT

Then, when asked to prompt code, enter the code you see on your phone.

Finally, connect with:

adb connect IP:PORT
3
  • What about when this fails? I used `"Forget" on the phone to forget the PC and now it can't connect ever again, it seems.
    – Slbox
    Commented Jun 27 at 2:03
  • @Slbox you should get a message on your phone when plugging through usb asking to grant permissions to the PC to use debug mode, you must first accept permissions.
    – Pedro
    Commented Jun 27 at 6:54
  • I realized that the problem was with failing to read your answer carefully. I've edited it to highlight my shortcoming. Feel free to undo if you disagree.
    – Slbox
    Commented Jun 27 at 19:39
2

None of the answers actually worked for me. What did the trick was to:

  1. On Android Wireless Debugging > Pair device with pairing code
  2. On cmd do adb pair ip:port with ip/port from above
  3. Device now appears on Android Studio > Device Manager
1

On Windows, I had to allow adb.exe through the Microsoft Defender firewall for this to work:

  1. Press the Windows key
  2. Search for "Allow an app through Windows Firewall" and press Enter
  3. Make sure adb.exe is allowed in there

I also had to connect both the PC and the phone to the WiFi only. Having the PC connected to ethernet only caused similar issues.

1
  • The above plus a restart of my PC solved it. Commented Dec 28, 2023 at 7:34
1

On my OnePlus 12, I had to disable developer options and enable it again, then pair using a QR code and it worked.

PS: I tried many options like adb pair / adb connect and restarting the WiFi, but nothing worked.

0

Sometimes putting my phone in Airplane mode for 5-10 seconds and then turning it off resets the connection and allows me to wirelessly connect to the device. If that doesn't work I will try turning the computer's wifi off and on too. Sometimes it works, sometimes it doesn't. Recently I wasn't able to connect wirelessly to my main computer, and it wouldn't work until I connected to a different one.

0

You did not talk about enabling Wireless USB debugging in the dev options. If you don't do it you should get an error which says that the connection has been denied by Android.

You should try to ping your phone. If the ping works, open a cmd and type 'adb connect 192.168.X.X' with the IP of your Android device.

Obviously your phone and computer have to be on the same network.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .