Android Debug Bridge (ADB) is a utility of command prompt for multi purpose that helps to get access to Android devices.
ADB allows doing the following:
- Install, copy, and delete files;
- Install a program on a device;
- Record a video or take a screenshot of the phone;
- Debug a device in case of its malfunction;
- Examine logs on the phone;
- Upgrade the firmware of the programs and system elements;
- Get full access to information about OS and a device.
ADB Installation and Environment Setup for PC With macOS
To install ADB on a PC with macOS, you have to do the following:
- Download the app installer for macOS from the official website.
- Unzip the file. Move the Platforms-tools folder anywhere you need.
- Activate Launchpad that is in the “Other” catalog. Then open the Terminal application.
- Go from Terminal to Platforms-tools using the cd command.
- When you’re in the correct directory, you need to examine ADB performance. For this, enter the “./adb” command in the Terminal menu.
- If you see information about used applications in the Terminal catalog then everything functions properly.
ADB Installation and Environment Setup for PC With Windows OS
To install Android Debug Bridge on Windows, you need:
- Download the app installer for Windows from the official website.
- Extract all the files from the archive. Move the Platforms-tools folder on disk C:/.
- Go to Control Panel > System and Security > System. Or you can use the following key combination: Win+Pause/Break. Then go to Advanced system settings.
- Go to Environment variables.
- In System variables, you have to select Path and click on Change.
- Write the path to platforms-tools with adb files.
- Reboot the system and activate the command prompt.
- Enter the adb version command. You have to see info about the ADB version. It means that installation was completed properly and the program is ready for use.
Preparing Android OS for ADB Performance
To fully use all the ADB functions on Android devices, it is necessary to make certain changes in the phone settings. Depending on the manufacturer, the configuration menu may vary. But in general, the main actions are the same:
- Go to Settings > About phone;
- Keep clicking on a build number until you see a message that you’re a developer;
- In main settings go to the Developer options section;
- Click on USB debugging;
- Connect the device to PC via USB;
- Confirm the debugging via USB on the phone.
Before you start working, you have to assure that PC identified a mobile device and the whole functionality works properly. To do it on PC with Windows, you have to write “adb devices” in the command prompt.If you work on PC with macOS, you should begin all the commands with “./”.
After this, you have to see the notification that all steps were correct and the program is ready for use. If you don’t see such a message, assure if there is an official utility driver.
The Most Common Commands in ADB
|adb||Command output into windows console|
|adb devices||Displays information about devices connected to the PC and their serial numbers|
|adb reboot||Android reboot|
|adb logcat||Compiles and shows logs on the device. The logs are displayed in a command prompt|
|adb push C:\Users\user\Documents\temp.txt /sdcard||Allows transferring files from PC to mobile device. For this, you have to write address for moving file and a place where it’ll be stored on the phone|
|adb logcat -d > ~/test.log||Compiles logs from the phone and records them in another file|
|adb shell screenrecord /sdcard/test.mp4||Records a video from the screen of a mobile device mentioning the file location, name, and extension|
|adb install C:\test.apk||Installs a program on a device. You just have to write a path to the utility|
|adb shell screencap /sdcard/test.png||Takes a screenshot of the mobile device mentioning the file location, name, and extension|
To Sum Up
Android Debug Bridge is a universal tool that is very useful for a tester especially when it comes to Android devices’ performance during mobile testing.
Even though ADB’s interface isn’t so compelling, its functionality is quite huge. And this is a key to effective work with mobile devices.