How to debug in Android Studio using adb over WiFi

后端 未结 15 1961
有刺的猬
有刺的猬 2020-12-04 06:32

I\'m able to connect to my phone using adb connect, and I can adb shell also.

But when I go to Run->Device Chooser, there are no devices there.

What should I

相关标签:
15条回答
  • 2020-12-04 07:20

    If you are using a rooted phone then try this application WiFi ADB.
    Probably this is the most simplest way to debug on wifi.
    I am using this application from many days and it works flawlessly.

    0 讨论(0)
  • 2020-12-04 07:21

    I used the following steps to successfully debug over wifi connection. I recommend this solution to everybody experiencing problems using integrated solutions like Android WiFi ADB plugin. In my case it failed to keep the Wifi connection to my device after unplugging USB. The following solution overcomes this problem.

    1. Connecting device

    a. Connecting device using local wlan

    If you have a local wlan you can connect your android device and your pc to this wlan. Then identify the IP address of the android device by looking into its wlan settings.

    b. Connecting device directly using a hotspot

    I prefer to connect with a hotspot on the device. This is more private and does not open your debugging connection to the (public) wlan.

    1. Create a Wifi hotspot on the Android device
    2. Connect PC to hotspot
    3. On PC look into network connection status of this hotspot connection to find the IPADDRESS of your device.
      My system showed IPADDRESS 192.168.43.1

    2. Create debugging connection

    1. Connect your device to USB.
    2. Issue command adb tcpip 5555 to open a port on the device for adb connection.
    3. Create wireless debugging connection adb connect IPADDRESS.
      In my case the command looked like adb connect 192.168.43.1

    The command adb devices -l should now display two devices if everything is ok. For example:

    List of devices attached
    ZY2244N2ZZ             device product:athene model:Moto_G__4_ device:athene
    192.168.43.1:5555      device product:athene model:Moto_G__4_ device:athene
    

    3. Keeping debugging connection

    The tricky part comes when unplugging the USB connection. In my case both connections are closed immediately! This may not be the case for all users. For me this was the reason that I could not use Android WiFi ADB plugin for android studio. I solved the problem by manually reconnecting the Wifi after unplugging usb by

    adb connect 192.168.43.1
    

    After that adb devices -lshows a single wifi connected device. This devices shows also up in android studio and can then be selected for debugging. When the connection is unstable you may need to repeat the above command from time to time to reactivate the connection.

    0 讨论(0)
  • 2020-12-04 07:22

    You may need to restart your adb via Android Studio (do it twice for good measure).

    resetting adb

    0 讨论(0)
提交回复
热议问题