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.

No comments:

Post a Comment