Run/install/debug Android applications over Wi-Fi?

前端 未结 30 1801
[愿得一人]
[愿得一人] 2020-11-22 07:16

I thought there was a way to test your applications in development over Wi-Fi. Is this possible?

I\'d love to be able to untether my phone and develop wirelessly.

30条回答
  •  -上瘾入骨i
    2020-11-22 08:05

    If you want to enable wireless adb on the device without connecting with a USB cable at all (root required):

    1. Install a terminal app on the device (like Android Terminal Emulator) Type the following
    2. su
    3. setprop service.adb.tcp.port 5555
    4. stop adbd
    5. start adbd

    Since you already have the terminal opened, you can find the IP address of the device:

    ip addr show
    

    Then in your debugging environment run command:

    adb connect ip.of.the.device
    

    This will make the device to be listed as any other emulators you might have. Note that the TCP will stay opened until you reset the device. You might also want to install a Wi-Fi Keep Alive app if you often experience disconnects.

    Remember to close the TCP when connecting to public networks if you want to feel safe. You can do the following or simply restart the device:

    1. su
    2. setprop service.adb.tcp.port -1
    3. stop adbd
    4. start adbd

提交回复
热议问题