ADB over wireless
Rooting is not required. With USB cable connected, port 5555 opened across all involved firewalls and debug mode enabled
adb tcpip 5555
then look into wireless properties of your device and the network you use, to see which IP address have been granted to device (or configure your DHCP always to use the same for the device mac address). Then
adb connect 192.168.1.133
(were 192.168.1.133 is a sample IP address).
This is all. You can now use adb shell
or adb install
or adb upload
or the like with USB cable plugged out.
To switch back to USB mode,
adb usb
The device may also revert back to USB mode after reboot.
This mode is needed for development of applications that use attached USB devices directly (USB port is used by device so cannot be used by ADB). It is briefly covered in the USB debugging section of the Android website.
How can I use adb over WiFi?
- Connect Android phone and host machine to same WiFi network
- Connect Android phone to host machine using USB cable (to start with)
- Run
adb tcpip 5555
from a command prompt - Run
adb shell "ip addr show wlan0 | grep -e wlan0$ | cut -d\" \" -f 6 | cut -d/ -f 1"
to obtain the phone's IP address - Disconnect USB cable and run
adb connect <ip_address>:5555
You can now view logcat output by running adb logcat
or by viewing the Android Monitor tab within Android Studio.
How to connect a device with ADB over WiFi when making app with Flutter?
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.
Related Topics
How to Update One Field from All Documents Using Pojo in Firestore
Android Gives Error "Cannot Fit Requested Classes in a Single Dex File"
How to Move Firebase Child from One Node to Another in Android
How to Print to the Console in Android Studio
On Zoom Event for Google Maps on Android
Android Getintent().Getextras() Returns Null
Android Retrofit Design Patterns
Libjvm.So: Cannot Open Shared Object File: No Such File or Directory
What Is the Equivalent of a Java Hashmap<String,Integer> in Swift
Does a Method's Signature in Java Include Its Return Type
Using Asynctask with Passing a Value
Preload Multiple Images with Glide
What Is the Equivalent to a JavaScript Setinterval/Settimeout in Android/Java
How to Avoid Unnecessary Firestore Reads with Cache
Android - Imageloader Must Be Init with Configuration Before Using in Uil