Android Debug Bridge (ADB) is a command-line tool that forms as a bridge between the device and the server. This tool helps to connect and communicate.
Role of adb in Tester’s life
Gone are the days when a functional issue observed is reported from UI perspective. It is important for a software tester to know what is actually happening on the device beyond what is just seen. It is equally important for a tester to point right at the issue as much as possible. Android Debug Bridge is one of the tools that actually help a tester to connect and analyze an Android device and applications on the Android device.
Where do you find adb?
adb is included in Android SDK Tools. If you are searching for Android SDK to download, click here. Make sure SDK Tools and Platform Tools are installed. Navigate to Android SDK folder > Platform Tools.
How do you run adb?
- We can set the path in Environmental Variables.
- Step 1 – Right Click on My Computer
- Step 2 – Click on Advanced System Settings
- Step 3 – In Advanced > Click on Environmental Variables
- Step 4 – Find Path in System Variables
- Step 5 – Copy path of adb file in System Variables path
- Step 6 – Click on Apply
Navigate to Android SDK folder > Platform Tools run the adb.exe file.
You’re Done!!! adb is set and can be accessed from the command prompt.
- Open a Command prompt in Android SDK > Platform Tools folder
- Step 1 – Navigate to Android SDK > Platform Tools folder
- Step 2 – Shift + Right click
- Step 3 – Click on Open PowerShell window here
adb commands can be executed in the PowerShell.
Handy adb Commands::
|adb -help||#This command will list adb version and commands that can be used on command line|
|adb version||#adb version details will be printed in command line|
|adb devices||#Prints list of devices/emulators connected to the system with device serial number|
|adb logcat||#Prints logs of the device connected to the system|
|adb pull||#This command helps in copying a specified file from an emulator/device instance to system|
|adb push||#Copies a specified file from the system to a device|
|adb shell||#Starts a remote shell in the target device|
|adb shell pm list packages||#Prints all package names which are installed in the device|
|adb kill-server||#Terminates the server process|
|adb install||#Install the selected application on the device|
|adb uninstall <package name>||#This command will remove the application with the package name mentioned from the device|
|adb shell dumpsys||#Prints device/emulator dumps on the command-line|
|adb shell screencap||#This command helps capture a screenshot on the device. We need to mention path to save the file after capturing.|
|adb shell screenrecord||#This command records the device/emulator screen.|
Other adb Commands::
|adb install -l <app.apk>||#forward lock application|
|adb install -p <app.apk>||#partial application install|
|adb install -r <app.apk>||#replace existing application|
|adb install -t <app.apk>||#allow test packages|
|adb install -s <app.apk>||#install application on sdcard|
|adb install -d <app.apk>||#allow version code downgrade|
|adb logcat *:V||#Filter to show Verbose level device/emulator logs|
|adb logcat *:D||#Debug level logs will be listed|
|adb logcat *:I||#Info level logs will be listed|
|adb logcat *:W||#Warning logs will be listed|
|adb logcat *:E||#Error logs will be listed|
|adb logcat *:F||#Fatal level logs will be listed|
|adb logcat *:S||#Silent, on which nothing is ever printed|
|adb logcat -c||#Clear entire logs and exists|
|adb logcat -v time||#Prints device/emulator logs with timestamp|
- Device Dumps
|adb shell dumpsys||#Dumps device/emulator data|
|adb shell dumpsys meminfo||#Dumps memory information of device/emulator|
|adb shell dumpsys meminfo <package name>||#Dumps memory information of a selected application from device/emulator|
|adb shell dumpsys batterystats||#Lists battery stats from the device|
|adb shell dumpsys batterystats –reset||#Erases battery stats of the device|
The commands listed above are mostly used in a tester’s daily activities. There are other adb commands that can give details and dumps from the device which are good to analyze. Directing the data from the device/emulator to a file will save the data in the file path.
For more information about our community and other events please visit our events page