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

前端 未结 30 2259
[愿得一人]
[愿得一人] 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条回答
  •  無奈伤痛
    2020-11-22 07:51

    I found my answer here:

    1. Connect Android device and adb host computer to a common Wi-Fi network accessible to both. We have found that not all access points are suitable; you may need to use an access point whose firewall is configured properly to support adb.
    2. Connect the device with USB cable to host.
    3. Make sure adb is running in USB mode on host.

      $ adb usb
      restarting in USB mode
      
    4. Connect to the device over USB.

       $ adb devices
       List of devices attached
       ######## device
      
    5. Restart host adb in tcpip mode.

      $ adb tcpip 5555
      restarting in TCP mode port: 5555
      
    6. Find out the IP address of the Android device: Settings -> About tablet -> Status -> IP address. Remember the IP address, of the form #.#.#.#. sometimes its not possible to find the IP-address of the android device, as in my case. so u can get it using adb as the following: $ adb shell netcfg and the should be in the last line of the result.

    7. Connect adb host to device:

      $ adb connect #.#.#.#
      connected to #.#.#.#:5555
      
    8. Remove USB cable from device, and confirm you can still access device:

      $ adb devices
      List of devices attached
      #.#.#.#:5555 device
      

    You're now good to go!

    If the adb connection is ever lost:

    1. Make sure that your host is still connected to the same Wi-Fi network your Android device is.
    2. Reconnect by executing the "adb connect" step again.
    3. Or if that doesn't work, reset your adb host:

       adb kill-server
      

    and then start over from the beginning.

提交回复
热议问题