How to connect multiple android devices with ADB over wifi

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:

  1. 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
    
  2. Open and copy the script using any editor like gedit.

    gedit adb_connect
    
  3. And make your file executable.

    sudo chmod +x adb_connect
    
  4. Modify your path to add the directory where your script is located:

    export PATH=$PATH:$HOME/bin
    
  5. Finally, now connect your device using USB and run the script:

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

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:

  1. Connect device A with a USB cable to the computer (but not B)
  2. adb -d tcpip 5555
  3. adb connect 192.168.1.32
  4. Disconnect device A, and connect device B with a USB cable to the computer
  5. adb -d tcpip 5555
  6. adb connect 192.168.1.33

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