Reading logs during testing Android applications often force developer or tester to use appropriate tools. One of them is: Android Device Bridge. ADB comes as a part of the standard Android SDK, it provides a terminal-based interface for interacting with your devices with Android file system. Below I added some useful commands that every tester, programmer use during deal with applications every day.

Useful commands:

  • access to Android device logs, direct output to the console
adb locat
  • this command allows to save logs in a file name you have specified, for example: abd logcat -d Users/user/storage
adb logcat -d > [filename]
  • logs on devices are erased, after that you are able to grab logs without unnecessary data
adb logcat -c - all
  • display logs with specified time
adb logcat -v time
  • reboot device
adb reboot
  • ensure that there is a server running
adb start-server
  • kill the server if it is running
adb kill-server
  • push apps from comupter onto device
adb push app /system/sd/app
  • prints: offline bootloader device
adb get-state
  • prints: serial-number
adb get-serialno
  • continuously print device status for a specified device
adb status-window
  • remounts the /system partition on the device read-write
adb remount
  • reboots the device, optionally into the bootloader or recovery program
adb reboot [bootloader|recovery]
  • restarts the adbd daemon listening on TCP on the specified port
adb tcpip
  • list PIDs of processes hosting a JDWP transport
adb jdwp
  • run PPP over USB Note: you should not automatically start a PPP connection. refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1 [parameters] – Eg. defaultroute debug dump local notty usepeerdns
adb ppp  [parameters]
  • above command will start an interactive shell from your machine, but running on your device
adb -s [yourdeviceserialnumberhere] shell
  • deleting existing apps on SD
adb shell rm -r /system/sd/app
adb shell rm -r /system/sd/app-private
  • return all information from the device that should be included in a bug report
adb bugreport
  • unlock bootloader, making root access possible
fastboot oem unlock
  • flash a custom recovery image to your phone
fastboot flash recovery
  • starting application using adb tools
adb shell am start -n com.package.name/.ActivityName

or

am start -n com.package.name/com.package.name.ActivityName

Reference:

  1. CyanogenMod Wiki
  2. developer.android.com
  3. XDA Developers Forum