Connect Mobile using Android Debug Bridge(ADB) over USB & WiFi: Detailed Guide
# Introduction to ADB
Android Debug Bridge (ADB) is a versatile command-line tool that allows communication with devices connected to your workstation. It facilitates various tasks, including debugging, testing, and pushing/pulling data. In this article, we will delve into the details of connecting your mobile device using ADB over both USB and WiFi connections.
# Enabling ADB for USB Connection
To begin, you must enable USB debugging on your device. This setting is found under Developer options in your device’s system settings. For devices running Android 4.2 (API level 17) and higher, Developer options are hidden by default. To make them visible:
1. Enable Developer options by going to Settings > About phone and tapping the Build number multiple times until you see the message that Developer mode has been enabled .
2. Enable USB debugging by going to Developer options > USB debugging and toggle it on.
Once USB debugging is enabled, connect your device to your workstation using a USB cable. Verify that your device is connected by executing the command `adb devices` from the android_sdk/platform-tools directory. If your device is connected correctly, you will see the device name listed as a “device” in the command prompt.
# Configuring ADB for WiFi Support
Prerequisites
Both your Android device and the host computer should be connected to the same wireless network . Additionally, Device Bluetooth should be disabled .
Steps to Connect
1. Connect your device using a USB cable to the host computer. Confirm that USB debugging is enabled in the device.
2. Set the target device to connect over TCP/IP on port 5555 :
“`bash
adb tcpip 5555
“`
3. Disconnect the USB cable from the device.
4. Find the IP address of your device in Settings > Wi-Fi Settings > Advanced > IP Address .
5. Connect to the device using ADB with the IP address and port:
“`bash
adb connect
“`
For example, if your IP address is 148.100.1.17:
“`bash
adb connect 148.100.1.17:5555
“`
# Troubleshooting Wireless Connection Issues
Check If Your Workstation and Device Meet the Prerequisites
Ensure that both your workstation and device meet the necessary prerequisites for wireless connection.
Check for Other Known Issues
– Wi-Fi Connection Issues : If you cannot connect over Wi-Fi, try using a cable or switching to a non-corporate network. Alternatively, use `adb connect` over TCP/IP (following an initial USB connection).
– Device Disconnects : If the device disconnects, reconnect to the network.
– adb Turning Off Automatically : If `adb` over Wi-Fi turns off automatically, reconnect to the device manually using `adb connect`.
# Enabling ADB over WiFi without PC or Mac
If you do not have a PC or Mac available, you can use another Android device or a Chromebook to enable ADB over WiFi. Here are the alternative methods:
Online Method
1. Open a browser on your ‘source’ device and go to [https://jolanrensen.github.io/WebADB-tcpip/](https://jolanrensen.github.io/WebADB-tcpip/). Follow the instructions.
2. This method has been tested on many late model Android phones and tablets and even works with a Chromebook in some cases.
Application Methods
There are applications like Bugjaeger Mobile ADB that can be used to enable ADB over WiFi. These applications have been tested and may work if you do not have access to a PC or Mac.
# Automating ADB over WiFi on USB Connection
To automate ADB over WiFi whenever your phone is connected to a computer that can run ADB commands, you can use tools like EventGhost or AutoHotkey . These tools can trigger a script to run the ADB commands when the phone is connected via USB.
# Conclusion
In conclusion, connecting your mobile device using ADB over both USB and WiFi is a straightforward process that requires some initial setup and configuration. By following the steps and troubleshooting tips outlined above, you can successfully establish a connection and utilize ADB for various purposes.