How to connect a device with ADB over WiFi when making app with Flutter?

Only Three Steps to follow:

  1. Connect via USB: adb tcpip 5555.
  2. Disconnect USB, Get Phone Ip Address Settings > About Phone > Status.
  3. Now adb connect 192.168.0.100

I had faced a similar issue myself when I first set up flutter..

I could easily connect my android phone using adb over wifi and debugging native code in android studio worked flawlessly..... using---

$ adb connect <device-ip>:5555

however when I ran "flutter devices" ... or "flutter run" .. the existing devices connected wirelessly using adb automatically got disconnected...

I received the following error in adb when I tried to connect adb during a flutter debug session -

ADB server did not ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 27779
--- adb starting (pid 27779) ---
adb I 07-29 02:24:57 27779 27779 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 07-29 02:24:57 27779 27779 main.cpp:57] Version 1:8.1.0+r23-5~18.04
adb I 07-29 02:24:57 27779 27779 main.cpp:57] Installed as /usr/bin/adb
adb I 07-29 02:24:57 27779 27779 main.cpp:57] 
adb I 07-29 02:24:57 27779 27779 adb_auth_host.cpp:416] adb_auth_init...
adb I 07-29 02:24:57 27779 27779 adb_auth_host.cpp:174] read_key_file '/home/<user>/.android/adbkey'...
adb I 07-29 02:24:57 27779 27779 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb server killed by remote request

On digging a little into forums and blog posts... i identified the issue here..

It seemed that Android Studio had downloaded and maintained its own copy of adb under the Android/ directory and ... incidentally flutter was using using that instead of the system provided binary ( /usr/bin/adb in linux ) ..

So flutter was killing the default adb server before starting its own adb .... and preventing other the system binary to run during a debug session.

Once this issue is identified ... fixing it is simple. I just symlinked the <android-platform-tools dir>/adb to /usr/bin/adb and everything worked fine....

alternately we could just delete one of the two binaries and change the required environment variables to achieve the same goal.