Strange that more people don't do this
ADB stands for Android Debug Bridge and it’s a utility you can install on your computer to perform actions on your Android device. If you’ve ever searched for any customization options for your Android device, you’ve likely heard of this utility as it’s used to customize Android devices as well.
In most cases, ADB is used over a USB connection to send and execute commands from your computer to your Android device. However, it works over a wireless connection as well. It’s really strange that not a lot of people talk about this useful feature of the utility.
By using ADB wirelessly with your Android device, you don’t need any mess of cables and you can perform various actions including taking screenshots, installing apps, removing apps, and so on, right from your computer wirelessly.
Use ADB Wirelessly For Non-rooted Android Devices
If you haven’t rooted your Android device or you don’t know what it is, then there’s an extra step you need to follow before you’re able to use ADB wirelessly.
You’ll need to first connect your device to your computer using a USB cable and then start the ADB server. It’s because the wireless ADB mode often doesn’t start the server required to connect your computer to your device.
Initiating The ADB Setup Over a USB Connection
- Head over to the ADB website and download and extract the package on your computer.
- Launch the Settings app on your Android device, tap on Developer options, and enable the option that says USB debugging. This is the option that lets you connect your computer to your Android over ADB.
- Plug-in your Android device to your computer using a USB cable.
- Launch a Command Prompt window (Windows) or Terminal window (Mac) in the ADB folder that you just extracted from the package. Type in the following command into the window and hit Enter.
adb devices (Windows)
./adb devices (Mac)
- A prompt asking if you’d like to allow USB debugging will appear on your device’s screen. Checkmark the Always allow from this computer box and tap on OK.
- You’ll see your Android device listed in your command line window. Type in the following command and hit Enter. There won’t be an output for this command.
adb tcpip 5555 (Windows)
./adb tcpip 5555 (Mac)
You’ve successfully set up the ADB service on port number 5555.
Finding Out The IP Address Of The Android Device
Now that the ADB server is up and running, you’re ready to connect to your device from your computer. To be able to do it, though, you’re going to need to first find out the IP address of your device.
Also, make sure your device is connected to the same wireless network as your computer.
- Launch the Settings app on your Android device and tap on About phone at the bottom.
- On the following screen, tap on the option that says Status which will let you see your network details.
- Scroll down on the following screen and you’ll find an entry saying IP address. This is the address you’ll be using so note it down somewhere.
You now know the location of your device on your network and it’s time to establish a connection between two of your machines.
Connect Wirelessly To An Android Device Using ADB
You’ll now send a request from your computer to your device asking to make a connection. Since your computer is already one of the authorized machines for USB debugging, you won’t get a prompt or anything like that asking for your permission.
- Get back to your command line window, type in the following command, and hit Enter. Be sure to replace IP with the actual IP address of your Android device.
adb connect IP
- If all goes well, the command line will output a message saying you’re now connected to the specified IP address.
Now that you’re connected to your Android device using ADB, you can issue any of the ADB commands you know and those will be executed on your Android phone.
Use ADB Wirelessly For Rooted Android Devices
If you’ve gained root-access on your device, then connecting to your device from your computer won’t require server initialization process. This means you won’t need to first connect the device using a USB cable.
You’ll need the IP address of your device, though.
- Head over to the Google Play Store and download and install the Terminal Emulator app on your device.
- Run the following command and provide the app with SU permissions on your device.
- Type in the following command one by one and these will initialize everything required for an ADB connection.
setprop service.adb.tcp.port 5555
- Run the following command replacing IP with the IP address of your device on your computer’s command line window. It’ll connect to your device using ADB.
adb connect IP
You can now run any of the commands you want on your device. Also, since your device is rooted, you can even run commands that require superuser permissions.
What ADB Commands To Try Out First
If you’ve never run any commands in ADB before, there are a few useful commands that you can run for the first time and get things done on your device.
- Reboot device – adb reboot
- Send file to the device – adb push source target
- Get file from the device – adb pull source target
- Install an app – adb install app-name.apk
- Uninstall an app – adb uninstall package-name
- Take a screenshot – adb shell screencap -p /sdcard/capture.png and then use adb pull /sdcard/capture.png to pull the screenshot to your computer
When you’ve finished, run the adb disconnect command to disconnect from your Android device.