#How to connect multiple Android devices with ADB over TCP
According to a post on xda-developers, you can enable ADB over Wi-Fi from the device with the commands:
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
And you can disable it and return ADB to listening on USB with
setprop service.adb.tcp.port -1
stop adbd
start adbd
Open terminal and install adb using
sudo apt-get install android-tools-adb android-tools-fastboot
Connect your phone via USB cable to the PC. Type following command in terminal to get the device ID:
$ adb devices
List of devices attached
LGV498b9cacc1 device
192.168.1.187:5558 device
192.168.1.184:5557 device
192.168.1.186:5556 device
192.168.1.143:5555 device
Using the device name listed above, get the IP of your Android device (if you know you can skip this step)
$ adb -s LGV498b9cacc1 shell ip -f inet addr show wlan0
22: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
inet 192.168.1.185/24 brd 192.168.1.255 scope global wlan0
Setup the communication port using this command:
$ adb -s LGV498b9cacc1 tcpip 5559
restarting in TCP mode port: 5559
Connect to your Android device IP address.
$ adb -s LGV498b9cacc1 connect 192.168.1.185:5559
connected to 192.168.1.185:5559
Verify if the device was added to the list:
$ adb devices
List of devices attached
192.168.1.185:5559 device
LGV498b9cacc1 device
192.168.1.187:5558 device
192.168.1.184:5557 device
192.168.1.186:5556 device
192.168.1.143:5555 device
Now you can remove your phone.
Enable Developer options in your Android phone using this way.
- Open Settings> About> Software Information> More.
- Then tap “Build number” seven times to enable Developer options.
- Go back to Settings menu and now you'll be able to see “Developer options” there.
- Tap it and turn on USB Debugging from the menu on the next screen.
Open your cmd and type adb. If you find that the adb is not a valid command then you have to add a path to the environment variable.
- First go to you SDK installed folder. Follow this path as an example. ```` D:\softwares\Development\Andoird\SDK\sdk\platform-tools; D:\softwares\Development\Andoird\SDK\sdk\tools; ```
- Now search on windows system advanced setting
- Open the Environment variable.
- Then open the "PATH" variable and paste the previous example path to its variable value.
- NOTE: You SDK path is different from mine please use yours. Now you can connect your android phone to PC.
Connect your phone via USB cable to the PC. Open cmd and type following command in terminal to get the device ID:
$ adb devices
List of devices attached
LGV498b9cacc1 device
192.168.1.187:5558 device
192.168.1.184:5557 device
192.168.1.186:5556 device
192.168.1.143:5555 device
Using the device name listed above, get the IP of your Android device (if you know you can skip this step)
$ adb -s LGV498b9cacc1 shell ip -f inet addr show wlan0
22: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
inet 192.168.1.185/24 brd 192.168.1.255 scope global wlan0
Setup the communication port using this command:
$ adb -s LGV498b9cacc1 tcpip 5559
restarting in TCP mode port: 5559
Connect to your Android device IP address.
$ adb -s LGV498b9cacc1 connect 192.168.1.185:5559
connected to 192.168.1.185:5559
Verify if the device was added to the list:
$ adb devices
List of devices attached
192.168.1.185:5559 device
LGV498b9cacc1 device
192.168.1.187:5558 device
192.168.1.184:5557 device
192.168.1.186:5556 device
192.168.1.143:5555 device
Now you can remove your device and run your Android project.