- Remotely see device screen and troubleshoot anytime.
- Lockdown device into single-app/multi-app mode.
- Set up alerts and workflows to cope with abnormal behavior.
- Streamline App management by distibute, install/update and mass uninstall Apps for bulk devices remotely.
What is ADB and How to Use It on Android Devices?
Everyone must know what Android Debug Bridge is because it is a very valuable tool for Android users, especially enterprises. Google has multiple features accessible only on Android devices with specific methods and paths, which standard Android users do not know. ADB helps us access such features of Android.
1What is ADB in Android?
ADB stands for Android Debug Bridge. It is a robust command line tool that enhances device capabilities by providing access to hidden Android phone or tablet features. ADB helps to execute multiple instructions that users can utilize to debug the device and get control over the device's behaviour.
It empowers users to perform specific actions that can cause difficulties otherwise. Its advantages are similar to those of SSH (Secure Socket Shell), but you should use it for currently deployed Android devices. Developers can use it more effectively to generate debug reports, view device info, and install Apps.
The three essential components of ADB are:
- Client: It runs on the development machine and forwards the command to the target phone using the ADB command from the command line.
- Daemon: It runs on the target Android phone and manages communication by running commands forward by the client.
- Server: A server is responsible for managing communication between the client and the daemon as a background process on the Computer.
2What is Android ADB Used For?
As a Command line tool, it facilitates seamless communication between a mobile, tablet, or other Android device and a Computer, which is not possible from the device itself. Let's get into details to know what can you do with ADB Android:
- With ADB, developers can install and debug Android apps on connected devices. It is a sophisticated way to test your apps on hardware devices.
- Users can seamlessly transfer files between their Computers and Android phones, including images, videos, and APK files.
- ADB is used to access a command-line shell and execute multiple commands on the device. It is particularly helpful for troubleshooting issues, inspecting logs, performing system-level tasks, and managing files.
- It also captures screenshots and records the Android screen using the command line, helping to analyze the app's behavior.
3How to Use ADB on Android Devices?
You need ADB commands to use ADB on Android devices. So, it important to know what are adb commands. These are instructions used to interact with Android devices.
1Install the ADB Tool on the Computer & Set Up
- Step 1:Download Android Studio
- Download and install the Android Studio. Make sure to download the latest version.
- Step 2:Open the Software
- After a successful installation, open it and click the ‘More Actions’ tab in the centre of the screen. Then, select SDK Manager from the list.
- Step 3:Choose SDK Tools
- Once in the SDK manager (Android SDK), click the SDK Tools option after SDK Platforms.
Select the following three options from the list:
Android SDK Command-Line tools
Android SDK Platform-Tools
Google USB Driver
- Step 4:Add Tools to the path
- After successfully installing the selected tools, add the tools file into the path. Here is the procedure:
Type ‘environment’ in the search bar and select ‘Edit the system environment variables’. Then select ‘Environment Variables’. Select the ‘New’ option, and you will see below ‘User Variables.’ Add variable name as ‘Android’. To add variable value, add the location of the tools for easy access. If the location is not changed, then by default, the location of tools is ‘ C:\Users{Your username}\AppData\Local\Android\Sdk\platform-tools’.
Also, turn on the ‘View hidden files’ tab in the form settings to get app data. Then press ‘OK’ to initiate.
- Step 5:Verification
- Now, verify if the path is effectively working. Here is the format to verify:
run command line > Windows key + R > cmd > enter
- Step 6:Connection confirmation
- Type ADB command “adb devices” to access the list of connected devices. If it is displayed, then it means you have added the correct path.
Now, the system is ready to use, and you can send commands to execute.
2Enable ADB on Android
To enable ADB on Android, you need to enable USB Debugging mode on the device. Here are the steps to enable it:
- Step 1: Open the Android’s ‘Settings’ app and scroll down to choose the ‘About Phone’ tab, which is available at the bottom.
- Step 2: Find the 'Build Number' option in the list and tap it seven times. This will enable 'Developer Mode,' and a pop-up will appear on the screen.
- Step 3: Return to the Settings menu, and you will see a new ‘Developer Options’ tab. Open it and enable the ‘USB Debugging’ option.
3Use ADB Commands to Interact with Your Android Device
After setting the above instructions on your Windows device and Android, you need to connect them. Use a USB cable to connect them and open the command prompt in the platform-tools folder.
Condition 1: Without Android Studio
If the tools are downloaded directly without Android Studio, they will be in the Downloads folder. Press Shift + right-click the Windows button when you are in the platform-tools folder and then select ‘Open PowerShell window here’ from the menu.
Condition 2: With Android Studio
If you downloaded Android Studio, move to an installed location using the command line and open it.
Open up the ‘More’ option and choose SDK Manager.
Now, set the location of the Android SDK and copy it. Open the command prompt again, type cd, and paste the location.
Now, type cd platform-tools, and it will process the commands.
Type ‘ADB devices’ command to see connected devices.
For remote connection between the PC and Android, you will use the following command:
Adb connect
4Examples - Things You Can Do with ADB
ADB is an easy-to-use tool, and its commands are almost similar to the function, so they are easy to recall when required. At the start of each command, ABD is entered in standard format. For example, you will use the ADB devices command to check the list of the connected devices. Moreover, it can manage almost all sorts of activities on Android devices. The commands built directly into the ADB binary should execute on all Android devices, while those running directly on the device might vary from device to device or from version to version.
Here are the examples of functions you can perform using the ADB command line:
- Kill the ADB server type: adb kill-server
- Set up port forwarding type: adb forward tcp:6100 tcp:7100
- Copy a file/directory to the device type: adb push
- Copy a file/directory from the device type: adb pull
- To initiate an ADB shell type: adb shell
- To install an application type: adb install
- To copy data from phone to PC type: adb pull
Remote is the path on your mobile for the file to download and it compulsory to add while local is an optional. You can add if you want to save in a specific folder on your PC. - To copy data from PC to Android type: adb push
Local is the PC location and remote is the Android location. - To Take screenshots type: screencap filename
- To record the screen type: adb shell screenrecord [options] path
You can record maximum video of 3 minutes with no audio and screen rotation support. - Find detailed information about the system services type: adb shell dumpsys
- To generate bug report type: abd bugreport
This command provides detailed system information, bug reports, and ensures easy collaboration. - To enable automation of form filling and text scenarios type: adb shell input text
5Extra Tips
5.1How to Turn Off ADB on Android?
You can turn off ADB by typing ‘adb kill-server’. After that, go to the device’s Settings app and navigate to ‘Developer Options.’ Move the slider to the left side after ‘Developers Option’ to disable it. Turning off ‘USB debugging’ also disables ADB on Android devices.
5.2How to Enable Wireless Debugging?
For Wireless Debugging, please ensure that your PC and Android device are connected to the same wireless network and that your device has Android Version 11 or later.
- Step 1: Enable the ‘Developer Options’ tab from the ‘Settings’ app on Android.
- Step 2: Open the Android Studio and click the ‘run configurations menu’ to choose the ‘Pair Devices Using Wi-Fi’ option.
- Step 3: Open the Wireless Debugging tab on Android to enable it, and pair the devices using a QR code or pairing code, as convenient.
- Step 4: After successful pairing, you can deploy apps on Android or perform other operations.
5.3Most Common Android ADB Commands
Here are some common ADB Android commands to control the devices.
- adb start-server: Start the ADB server on your computer. This will be executed automatically.
- adb devices: Lists all devices in the network that have the ADBd (ADB daemon) running.
- adb connect
: Connect to a specific device via IP or device name. - adb disconnect: Disconnect from a specific device.
- adb kill-server: Close the local ADB server on your computer.
- adb shell pm list packages: See a list of all installed packages on the device.
- adb install
: Installs a local apk on the connected device. - adb uninstall
: Uninstalls the specified package from the device. - adb shell dmesg: Prints kernel logs.
- adb logcat: Prints Android logs in your local shell.
- adb bugreport: Creates a comprehensive bug report and saves it to your computer.
- adb remount : Remounts the /system partition to be writable.
- adb reboot: Reboots the connected device.
6Top Alternative Tools to ADB (for Android Device Management)
Android SSH
Android Secure Socket Shell or Secure Shell is an open network protocol enabling secure communication between devices. You can use Android SSH as an ADB alternative because it is comparatively much more secure, and ADB lack the necessary security parameters. Moreover, SSH allows remote device access and file transfer without file size limitations.
Mobile Device Management
For more comprehensive device management and security, we recommend using an MDM solution. MDM provides an extensive dashboard to meet all business end-points for device management, such as monitoring and controlling a large fleet of devices, enforce security policy, setup kiosk mode, App management and bulk file transferring with data encryption.
AirDroid Business is a powerful device management solution that enables businesses to manage multiple devices remotely from an admin console.
7Conclusion
Android debug Bridge is a command line tool that creates a medium of communication between PC and Android devices. ADB has three primary components on which it works, i.e., client, daemon, and server. Some commands are identical on all Android devices, while others might vary depending on the device model and Android version. ADB is used to perform various tasks, including sharing files, taking screenshots and recording videos, installing apps, generating bug reports, accessing information about system services and many more valuable functions. For remote monitoring and control of Android devices, we recommend using the MDM solution instead of ADB because MDM provides comprehensive remote features and centralized management support for bulk devices and is more intuitive than ADB.
Leave a Reply.