ADB is installed in the computer, and usb debugging is enabled on devices. Also I have connected one device over wifi successfully. How to connect more devices without having to mention the serial number of the device for every additional device with the -s flag like: adb -s <serial> tcpip <port>
 
    
    - 3,614
- 4
- 34
- 56
3 Answers
Yes there is a way to do so without having to type the serial number.
Say you have 2 devices A (IP: 192.168.1.32) and B (IP: 192.168.1.33) that you want to connect to ADB over wifi:
- Connect device A with a USB cable to the computer (but not B)
- adb -d tcpip 5555
- adb connect 192.168.1.32
- Disconnect device A, and connect device B with a USB cable to the computer
- adb -d tcpip 5555
- adb connect 192.168.1.33
 
    
    - 3,614
- 4
- 34
- 56
A slight change in the Abdul Wasae answer, based on my experience .
devices A (IP: 192.168.1.32)
devices B (IP: 192.168.1.33)
Connect device A with a USB cable to the computer (but not B)
adb -d tcpip 5555
adb connect 192.168.1.32
Disconnect device A, and connect device B with a USB cable to the computer,This time you need to change the port !!
adb -d tcpip 5554
Here you need to specify port as well
adb connect 192.168.1.33:5554
I also have documented this here in more detail Connecting multiple devices over wifi using adb
 
    
    - 2,555
- 2
- 17
- 31
- 
                    curious, why you need to change the port tho? in my case it works well with the same port value 5555 – wood wood Aug 05 '20 at 07:16
I have this problem long time ago so I decided to create this simple bash script.
Assuming that you already added the adb to the path:
export PATH=${PATH}:/home/YOUR-USERNAME/path/to/adb
You just need to follow this steps:
- Run this commands: to create your script (typically, you want $HOME/bin for storing your own scripts) - cd ~ mkdir bin cd bin touch adb_connect
- Open and copy the script using any editor like gedit. - gedit adb_connect
- And make your file executable. - sudo chmod +x adb_connect
- Modify your path to add the directory where your script is located: - export PATH=$PATH:$HOME/bin
- Finally, now connect your device using USB and run the script: - adb_connect
- Your device must be connect now, disconnect the USB cable and repeat steps 5 and 6 to add more devices. If a successful connection occurs, it will have this output: - Connecting to LGV498bdcb2c5 restarting in TCP mode port: 7105 connected to 192.168.20.105:7105
 
    
    - 7,189
- 1
- 50
- 48