DEV Community

Cover image for How to debug Flutter apps over Wi-Fi(without root)
Takunda Madechangu
Takunda Madechangu

Posted on

How to debug Flutter apps over Wi-Fi(without root)

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

Debugging over wifi

Debugging over wifi

Requirements

  • Your phone πŸ“±
  • Your machine πŸ‘¨πŸ½β€πŸ’»
  • A USB cable. γ€œ
  • Your machine and phone should be connected to the same wifi.

Steps

Step 1
Connect your device to your machine using USB

Step 2
Open terminal and type the following

$ adb kill-server
$ adb tcpip 5555
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Remove phone from mobile device and go to the next step

Step 3
Get you device's wifi IP address. To do this:

Go to
Settings > Connections > Click Wifi Name > View properties(Which has the IP)

Or

Settings > About Phone > Status > IP Address(Which has IP)

Your ip should be something like 192.168.100.X

Step 4
Inside your terminal type

adb connect YOUR_IP:5555
Enter fullscreen mode Exit fullscreen mode

And if it says something like this:

connected to 192.168.100.X:5555
Enter fullscreen mode Exit fullscreen mode

You are good to go

Safety Concerns

Wifi hacks

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...

Outro Meme

Top comments (1)

Collapse
 
abbatyya profile image
abbatyya

bravo, kudus to you