Android Tip: More detailed stack traces

I noticed that stack traces generated by my app does not show any source file information next to the method names in the stack. This was really annoying as it would make it more difficult to narrow down the line causing the exception. I suspected this was due to debug information not being generated by the compiler and with a little hunting around in settings found the way to enable it:

Right click the project and select "Properties" -> "Java Compiler" -> check the "Add source file name to generated class file" checkbox.

You will likely need to check the "Enable project specific settings" checkbox first enable changing this setting.

Now it prints prints the source file and the line number making it much easier to figure out the source of the exception without having to attach the debugger.

3 comments:

  1. Thanks for sharing this tip with us, not everyone is aware of it and this need to be shared by others. Great post, thanks for sharing it with us and keep posting more such posts

    ReplyDelete
  2. These kind of issues usually happens with all the new devices. Its not because of some error but settings are sometimes different than the previos version which you need to explore.

    ReplyDelete
  3. The list displays thumbnail images of apps--instead of just icons--so you can see which part of the apps are currently working in the background.Visit website

    ReplyDelete