The Flutter enables wireless debugging

1. Make sure your computer and phone are on the same LAN

2. Need to open THE USB debugging for the first time (obtain the device number, do not need to use in the future)

3. Use ADB to view connected Android devices: ADB Devices (using CMD is recommended, powershell has some issues that I haven’t explored in depth)

If successful, the following page appears

If it is not successful, the following error is most likely due to adb not configuring the global environment.

Solution:

Open Android Studio => Tools > SDK Manager to find the path to ADB

New Android Studio, adb.exe in platform-tools folder, for example, my path is C:\Users\Administrator\AppData\Local\Android\Sdk\platform-tools

Configure the system environment variables.

Go back to step 2. If you have any more questions, please do your own search

4. Run the adb -s [device id] tcpip [port] command to specify a port number for the device that requires wifi connection

  1. The device ID is the value in the red box in step 3
  2. Port indicates the port number for the user-defined connection. I use 5555
  3. If you have only one device, you do not need to add the -s command

The first failure above was caused by the fact that I unplugged the USB in advance and could not find the device. The second display is reset, because I have set it once. If it is the first time, it will show success

Adb connect [phone IP]:[port]

Here, the phone IP is the IP of your phone in the LOCAL area network at this time. Take Huawei mobile phone as an example, choose Settings >WLAN > connected wifi, and the last popup will be displayed

Take me: ADB Connect 192.168.10.136:5555Open your Flutter project at this point and you will find that your phone is connected remotelyRun Flutter Run and select your phone

6. Let’s turn off the wifi on our phones and try to reconnect

  1. Now you can see that my phone is offline in the device list and not in the Flutter project

  1. Adb connect 192.168.10.136:5555: adb connect 192.168.10.136:5555: adb connect 192.168.10.136:5555: adb connect

  1. To turn it off, use adb Disconnect [phone IP]:[port]