Let's just say you want to debug your Flutter app on android device, you use a USB cable right?
Yes but using a USB cable has its downsides
- If your charging port is loose for some reason, then a slight move will disconnect your app ☹️
- On MacOS is displays a certain annoying "Please install SmartSwitch or some app" message
- Lack of flexibility
- Among other annoyances
So lets try debugging over wifi
- Your phone 📱
- Your machine 👨🏽💻
- A USB cable. 〜
- Your machine and phone should be connected to the same wifi.
Connect your device to your machine using USB
Open terminal and type the following
$ adb kill-server $ adb tcpip 5555
This will kill current adb server and create another server which listens on all interfaces.
If it says something like this
* daemon not running; starting now at tcp:5037 * daemon started successfully restarting in TCP mode port: 5555
Remove phone from mobile device and go to the next step
Get you device's wifi IP address. To do this:
Settings > Connections > Click Wifi Name > View properties(Which has the IP)
Settings > About Phone > Status > IP Address(Which has IP)
Your ip should be something like
Inside your terminal type
adb connect YOUR_IP:5555
And if it says something like this:
connected to 192.168.100.X:5555
You are good to go
While this method offers convenience and flexibility, it might not be safe to do it on a public wifi or a wifi that you don't trust. After all someone might be listening in for open ports just to do something crazy, So be careful...