- How to connect multiple android devices with adb over wifi?
- Method 1: Connecting Devices via Wi-Fi Direct
- Step 1: Enable Wi-Fi Direct
- Step 2: Connect the Devices
- Step 3: Enable ADB over Wi-Fi
- Step 4: Connect ADB to the Devices
- Method 2: Connecting Devices via TCP/IP
- Method 3: Connecting Devices via a Wi-Fi Network
- Step 1: Connect Your Devices to the Same Wi-Fi Network
- Step 2: Connect Your Devices to ADB
- Step 3: Find the IP Address of Each Device
- Step 4: Disconnect Your Devices from USB
- Step 5: Verify Connection
- Step 6: Repeat for Each Device
- How to connect to multiple devices over wifi using adb?
- Connecting First device over WiFi
- Connecting Second device over WiFi
How to connect multiple android devices with adb over wifi?
Connecting multiple Android devices with ADB (Android Debug Bridge) over Wi-Fi can be a useful and efficient way to manage and debug your Android devices. This can be especially helpful if you don’t want to connect each device individually to your computer via USB, or if you have a large number of devices to manage. The following are several methods for connecting multiple Android devices with ADB over Wi-Fi.
Method 1: Connecting Devices via Wi-Fi Direct
To connect multiple Android devices with ADB over Wi-Fi Direct, you can use the following steps:
Step 1: Enable Wi-Fi Direct
First, you need to enable Wi-Fi Direct on all the devices that you want to connect. You can do this by going to the device’s settings and turning on Wi-Fi Direct.
Step 2: Connect the Devices
Next, you need to connect the devices using Wi-Fi Direct. You can do this by following these steps:
WifiP2pManager wifiP2pManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); WifiP2pManager.Channel channel = wifiP2pManager.initialize(this, getMainLooper(), null); wifiP2pManager.discoverPeers(channel, new WifiP2pManager.ActionListener() @Override public void onSuccess() // Peers discovery started > @Override public void onFailure(int reasonCode) // Peers discovery failed > >);
This code will initialize the Wi-Fi Direct manager and start discovering peers. Once the peers are discovered, you can connect to them using the following code:
WifiP2pDevice device; // The device you want to connect to WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; config.wps.setup = WpsInfo.PBC; wifiP2pManager.connect(channel, config, new WifiP2pManager.ActionListener() @Override public void onSuccess() // Connection successful > @Override public void onFailure(int reason) // Connection failed > >);
Step 3: Enable ADB over Wi-Fi
Once the devices are connected, you need to enable ADB over Wi-Fi on each device. You can do this by running the following command in a terminal:
Step 4: Connect ADB to the Devices
Finally, you can connect ADB to the devices using their IP addresses. You can get the IP address of a device by running the following command:
adb shell ip -f inet addr show wlan0
Once you have the IP address of a device, you can connect to it using the following command:
adb connect device-ip-address>:5555
Repeat this step for each device that you want to connect to ADB.
That’s it! You have now connected multiple Android devices with ADB over Wi-Fi Direct.
Method 2: Connecting Devices via TCP/IP
Connecting multiple Android devices with ADB over WiFi can be done by using the TCP/IP method. Follow these steps to connect multiple devices:
- Connect the first device to your computer using a USB cable and enable USB debugging in the developer options.
- Open a terminal or command prompt and type the following command:
adb connect ip_address>:5555
Here is an example of how to connect two devices:
adb -s device1_serial_number> tcpip 5555 adb -s device1_serial_number> shell ip -f inet addr show wlan0 | grep -Po 'inet \K[\d.]+' adb connect device1_ip_address>:5555 adb -s device2_serial_number> tcpip 5555 adb -s device2_serial_number> shell ip -f inet addr show wlan0 | grep -Po 'inet \K[\d.]+' adb connect device2_ip_address>:5555
In this example, we first connect the first device using its serial number and obtain its IP address using the ip command. We then connect to the device using its IP address.
We repeat the same steps for the second device, replacing with .
Note that you may need to run these commands as sudo or administrator on some systems.
That’s it! You should now be able to use ADB with multiple devices over WiFi.
Method 3: Connecting Devices via a Wi-Fi Network
To connect multiple Android devices with ADB over Wi-Fi, you can use the following steps:
Step 1: Connect Your Devices to the Same Wi-Fi Network
Make sure that all the devices you want to connect are connected to the same Wi-Fi network.
Step 2: Connect Your Devices to ADB
Connect your devices to ADB using USB cables and run the following command in the terminal:
This will enable TCP/IP mode on your device.
Step 3: Find the IP Address of Each Device
Find the IP address of each device by running the following command in the terminal:
adb shell ip -f inet addr show wlan0
This will show the IP address of the device.
Step 4: Disconnect Your Devices from USB
Disconnect your devices from USB and run the following command in the terminal:
adb connect device-ip-address>:5555
This will connect your device to ADB over Wi-Fi.
Step 5: Verify Connection
Verify that your device is connected to ADB over Wi-Fi by running the following command in the terminal:
This will show a list of all the devices connected to ADB.
Step 6: Repeat for Each Device
Repeat the above steps for each device you want to connect to ADB over Wi-Fi.
How to connect to multiple devices over wifi using adb?
In Mobile Automation , the one thing which is quite irritating is a bad usb cable. so is there any way, by which we can connect to our mobile devices using adb?
The answer is yes!!
I will connect 2 mobile devices over WiFi!!
And how can we do that , is explained in below steps
Connect your laptop,mobile devices to same wifi connection
- This is extremely important, your laptop and all the mobile devices should be connected to same wireless network
Connect 1st device to USB cable and plugin to laptop
- one of your device should be connected to laptop via USB cable
- Make sure that connected device is visible
- run adb devices command as shown below
Connecting First device over WiFi
This will run the adb in tcpip mode
now ,we need to find the IP of the network on which our mobile devices are connected .
go to Settings>System>About-phone
Click on Status as shown below
Note down the IP address
Now we will use this address to connect to mobile devices using command
adb connect 10.162.138.72
run command
Basically both the enteries are for same device. if you remove cable, you will get only one entry and your device will be connected via Wifi now.
but,before removing the cable, lets connect second device as well!!
Connecting Second device over WiFi
Make sure you have removed first device from cable and connected second device.This is extremely important.
Once connecected,run command adb -d tcpip with different port
adb -d tcpip 5554" data-image-title="second_adb_tcp_ip" data-image-description="" data-image-caption="" data-medium-file="https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=300" data-large-file="https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=700" src="https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=700" alt="second_adb_tcp_ip" srcset="https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=700 700w, https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=150 150w, https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=300 300w, https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg?w=768 768w, https://automationlab0000.files.wordpress.com/2019/01/second_adb_tcp_ip-1.jpg 821w" sizes="(max-width: 700px) 100vw, 700px" />
Now !! check the IP address of second device as well and run command
adb connect 10.162.60.83:5554
and run adb devices command
Both the devices are now connected over wifi !! In the similar way, you can connect many more devices.
Some times the device connected first disappears from the list, in that case , you simply need to run connect command again for that particular device IP address, with specified port
adb connect 10.162.138.72:5555