13-Mastering ADB (Android Debug Bridge) Commands
Overview
This lecture covers Android Debug Bridge (ADB) commands for mobile application testing, focusing on setup, usage, and essential commands for QA engineers working with Android devices.
Introduction to ADB and Android Studio
- ADB (Android Debug Bridge) is a command-line tool to communicate with Android devices for debugging and device management.
- QA engineers use ADB to install builds, collect logs, and manage devices in Android testing.
- Android Studio includes an emulator and ADB as part of the Android SDK.
Setting Up Android Studio and Emulator
- Download and install Android Studio from the official website—which includes the Android emulator and SDK tools.
- Minimum system requirements: 16 GB RAM, 16 GB free disk space, Windows 10+ or macOS 12+.
- Use Android Studio’s Virtual Device Manager to create and manage Android Virtual Devices (AVDs).
- Launch the emulator to simulate different Android devices for app testing.
Setting Up and Accessing ADB
- ADB is located in the
platform-tools
directory of the Android SDK folder.
- Open command prompt (Windows) or terminal (macOS/Linux), and navigate to the
platform-tools
directory.
- Enable developer options and USB debugging on the virtual or physical device via device settings.
- Use the command
adb devices
to verify that your emulator/device is connected.
Core ADB Commands for QA Testing
adb devices
— Lists all connected devices/emulators.
adb install
— Installs an APK onto the connected device/emulator.
adb uninstall
— Uninstalls an app by its package name.
adb logcat
— Shows real-time logs from the device (useful for debugging and bug reports).
adb bugreport
— Generates a comprehensive bug report zip file from the device.
adb push
— Copies files from your computer to the device.
adb pull
— Retrieves files from the device to your computer.
adb shell screenrecord
— Records the emulator/device screen.
adb shell am start -d
— Opens a specified deep link in the device.
Using the Android Emulator for Testing
- Test app functionality, UI, and device-specific features using the emulator controls.
- Emulator supports simulating hardware changes, network speeds, orientation, and sensor state.
- Use extended controls for bug reporting, screen capture, and video recording during testing.
Common Interview Questions & QA Practice
- What is ADB and its primary function? (Command-line tool for device management and debugging)
- How do you check connected devices? (Use
adb devices
)
- Which command installs an app? (Use
adb install
)
- Which command collects system logs? (Use
adb logcat
or adb bugreport
)
Key Terms & Definitions
- ADB (Android Debug Bridge) — A tool for sending commands from your computer to an Android device.
- Android Studio — Official integrated development environment for Android app development and testing.
- AVD (Android Virtual Device) — A virtual Android device used for testing in the emulator.
- SDK (Software Development Kit) — Tools for developing applications on a platform.
- APK (Android Package) — File format for Android application installation packages.
- Logcat — System log output for Android devices.
Action Items / Next Steps
- Watch the mandatory self-learning videos on device logs and ADB usage.
- Practice basic ADB commands:
adb devices
, adb install
, adb uninstall
, adb logcat
.
- Download and experiment with Android Studio and the emulator if possible.
- Review the ADB cheat sheet for further command reference.
- Read the glossary of terms and prepare for module four.