Thursday, September 22, 2016

ADB Commands Used in Testing

ADB (Android Debug Bridge) is a command line tool to control Android devices
The ADB tool is located in the directory <android_sdk>/platform-tools/. You should put this directory in the PATH environment variable.
Common ADB commands used in testing:
adb devices
Lists all devices and emulators attached to the system
Note: Once the device is connected to PC via USB cable, make sure “usb debugging”
Option is turned on in developer option and appropriate device driver is installed
adb install <APK path>
Installs the new applications on the device
adb uninstall <Package name>
Uninstalls the specific application
adb install  -r <APK path>
Replaces existing application, application data is not deleted on replacing the app.
adb logcat
Logcat is a command that reads logs from Android devices. Pressing “Ctrl+C” terminates the logcat event. To dump the logs in to a file use adb logcat –d > filename.txt
adb shell
Executing adb shell commands exposes the android shell, adb shell gives access to device internals.
Most of the standard Linux commands like “cd,ls,cat,rm” can be used from android shell
Transferring the files using adb
Most of the android devices primary media storage is mapped to “/mnt/sdcard/” so we can use adb command line to push and pull the files from devices.
adb push <file path in PC>  <file path on device>
This command pushes the file from PC to Device
adb pull <file path on device> <file path in PC>
This command pulls a file from device to PC

No comments:

Post a Comment