skip to Main Content

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)

enter image description here

7

Answers


  1. Chosen as BEST ANSWER

    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

    enter image description here

    I don't know why there the issue with dynamic IPs



  2. 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

    1. Make sure USB Debugging is enabled on the device you intend to connect with
    2. In your device, go to Developer Settings>Wireless Debugging and you will see something like so

    Sample Screenshot

    1. 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

    Login or Signup to reply.
  3. 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.

    Android Wi-Fi Settings

    Login or Signup to reply.
  4. 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.
    Login or Signup to reply.
  5. I had the same problem but I managed to find the solution.
    You have to follow the following steps:

    1. In your smartphone (Go to Settings->Developer options-> Wireless Debugging->Pair device with pairing code).
    2. Copy the ipaddress & port.
      For example: 192.168.1.2:42123
      and wifi pairing code: 234321.
    3. Open your terminal and go to the following path:
      cd %LOCALAPPDATA%/Android/sdk/platform-tools
    4. 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
    5. Paste the access code to the wifi connection.
      Enter pairing code: 41107.
    6. 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.

    Login or Signup to reply.
  6. 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.

    Login or Signup to reply.
  7. Important reminder and this is what solved my problem.

    Devices must be on the same network.

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