skip to Main Content

I used to connect my physical device with Android Studio via wireless mode (Wi-Fi). On the first time, when I connect my physical device using Device Manager, it connects easily. But after 1-2 hour or when system goes in sleep mode, Eventually physical device discoonects automatically from the Device Manager even when connected via WiFi.

I have a MacBook Air with the macOS Monterey operating system, and I’m using the latest version of Android Studio.

DEVICE MANAGER

Issue I’m actually facing:

My device disconnects automatically after sometime when I already connected via WiFi. I’ve tried both methods – "Pair using QR code" and "Pair using pairing code" to connect the device and my Machine (MacBook). The device shows that it’s connected, but the machine just says "connecting" and never fully connects. After a few minutes, it shows an error message.
However, sometimes it reconnects automatically without me doing anything.

After disconnecting from the Device Manager, I used to connect using the cable connectivity because Device Manager just shows connecting for a few minutes and then shows an error.

I figured out why it sometimes disconnects on its own:

  • Wi-Fi is not connecting or disconnects from the network
  • Device either switch Wi-Fi networks or disconnects from the network
  • Machine and device are not connected to the same wireless network
  • Machine or Device goes idle for sometime
  • Sometimes disconnected automatically without any reason (That’s the actual issue which I facing)

Ways I tried but didn’t get the expected results:

  • Re-connected Machine and Device on the same wireless network
  • Invalidating caches and restarting Android Studio
  • Restarting Android Studio
  • Revoking/reaccepting USB debugging authorization
  • Try connecting in a different way by using either "Pair using QR code" or "Pair using pairing code"
  • I also looked at the official documentation but not fount a suitable solution: Troubleshoot device connection

Reviewed other similar questions:
I have examined questions already posted on Stack Overflow regarding the same issue, but I have not found a suitable solution.

2

Answers


  1. Chosen as BEST ANSWER

    While debugging I thought, There is a glitch in the Android Studio but the results are totally different. I debugged the issue & found mobile device is also a cause of auto-disconnecting from the Device Manager while connected via Wi-Fi in Android Studio.

    Just Restart the physical device & try to reconnect with Device Manager in Android Studio using the Pair device with QR code or Pair device with pairing code. It works 100%.

    Another Way:

    • Go to Settings
    • Select Developer options
    • Turn off Wireless debugging
    • Click on "Revoke USB debugging authorisations"
    • Again turn on Wireless debugging and Allow wireless debugging
    • Now pair the device using Pair device with QR code or Pair device with pairing code with Device Manager in Android Studio

  2. I am not a Mac user, but on Windows, the wifi connection to Android is also buggy. I have experienced the same error that you experience. There is no solution for that. But, there is a way to make it work 100%.

    • The laptop will connect to the WiFi.

    • Laptop will open a Mobile hotspot (idk if it is available in Mac)

    • Mobile’s Wifi will connect to that hotspot.

    • for the first time pair with code and then always connect

      ./adb connect 192.168.137.254:37785

    ==> This will always work. Without a hotspot, you will experience all sorts of problems.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search