Tuesday, March 25, 2014

Android Studio logcat - tips

The logcat is probably your best friend during development and debugging. Here's a few tips to make it more accessible:

  1. Bring in the colors! Read this great post at stackoverflow for instructions.
  2. In your Run/Debug configuration in Android Studio - mark "Clear log before launch" - that way you will be sure to look at the log that relates to the latest deployment.
  3. While debugging - toggle on the "Only show logcat from selected processes" button
  4. Select the filter for the current package
  5. Expecting an error? set the log level to Warn
And another thing - if you ever lose the connection to the logcat, and you can't disconnect/connect your device - try calling from terminal: 
adb kill-server
adb devices
That can help in restarting the ADB and re-monitoring the logcat.