Capturing Device Logs Using ADB



ADB is a command-line utility that that can be used to control your device over USB from a computer. It will allow you to install / uninstall and or view logs on your device. This could be very handy when there are issues with a specific app and you like to view the logs for information that may lead to identify the cause of error.

In this post, we’ll discuss how to install and use ADB.

ADB comes with Android SDK. However, you can download ONLY the ADB files from HERE. Download it from the link and copy into a file like c:\tools\adb
Using this approach, there are no specific installation that are needed. Just copy files onto a folder like:

There are times that it would be necessary to view / monitor logs on your device. To accomplish this, you need to use a USB cable and enable debugging on your device. Follow instruction HERE for enabling USB debug.

Next, shell to DOS and CD to folder that you installed ADB:
cd c:\tools\adb

To start ADB, enter:
adb logcat

Above command will start displaying logs. Now you can start any app and then view / capture the log out.
To narrow down the amount of logs, you can change the Log Level. For example, if you log to only view ERRORS, enter:
adb logcat *:E

For a list of ADB commands, visit site HERE

An alternative to DOS Command Window is ConEmu which can be downloaded from sourceforge HERE. It includes multi-tab features and ability to easily copy the logs.

Debugging app crash?
I imported app inventor project to appybuilder
In some device app running but in some device app not runnning why?

Thank you Mr. Hossein for the good tutorial. I always use screenshot to capture error alert but this is much better.



Glad you like the tutorial. In addition, you can do the following. 1 will clear previous logs. 2 will only list logs related to your package name (control-c to break). Item 3 can be used to print the generated logs into a file so that it can be viewed using text editor - or emailed to developer

  1. adb logcat -c #clears the log
  2. adb logcat | grep -i “foo.example.” #get all logs related to “foo.example.*” tagname
  3. adb logcat -f <output_file>


FYI Mac users running El Capitan or later. Installing ADB is dead simple. The instructions below worked for me the first time. They’re a little scary if you’re unfamiliar with the command line, but just follow the directions and you’ll be fine. Also, definitely, you need to log out and log back in for the tools to be available (updates the PATH variable to include the installation directory).


Another key element I just ran into: your phone has to be disconnected from USB before you can enable debugging under the “Developer Options” menu, if USB debugging is greyed out, that’s likely your problem (assuming you’ve followed the other directions correctly).