Friday, 25 February 2011

Android Debug Bridge - Basic notions

Android Debug Bridge (ADB) is a tool that can come with the SDK. It allows you to interact with the emulator or with the android device through the console or terminal.

It is located in the platforms-tools in your SDK directory. To invoke it, just do the follow
1. Open and terminal or an console
2. Go to your SDK directory
3. Go to your platform-tools directory

Here come some basic commands:
adb help
List all the devices
adb devices
It shows a list of deivces with their serial number and their current states. If a device shows "device" as state, then it is connected.
To give a command to a specific device
adb -s  <serialnumber> <command>
To install an application

adb install <path_to_apk>
To copy/paste
  • emulator or device -> computer
adb pull <remote_file><local_directory>
  • computer ->  emulator or device
adb push <local_file><remote_directory>
Print log data
adb logcat
Get the serial number
adb get-serialno
Get the current state 
adb get-state
Advanced adb
Starts a remote shell in teh target emulator/device instance
adb shell
Forward an port
adb forward  <incoming_port><outcoming_port>
Print dumpsys, dumpstat and log data
adb bugreport
Print JDWP processes
adb jdwp

More info here:

No comments:

Post a Comment