开发者

"Break On Exception" in Eclipse/Android

I'm primarily a C#/VS dev, but will be debugging an Android application in the near future. I can't seem to find a setting in eclipse that will cause it 开发者_运维百科to break into the debugger when an exception occurs (regardless of whether there is an exception handler handling it).

This feature is available in visual studio via the Debug > Exceptions menu.

Is there anything similar in eclipse? otherwise, how does one figure out the source of an exception assuming limited initial knowledge of the codebase?


I don't know whether this also applies to Android debugging, but the feature is available for Java. In Eclipse, switch to the "debug" perspective. In the "Breakpoint" view, you will notice a little icon (at the top right, near the "minimize" button of the view) with a J and an exclamation point. This is the trigger to add "exception" breakpoints.

With this dialog, you can tell the debugger to suspend and caught and uncaught exceptions alike.


how does one figure out the source of an exception assuming limited initial knowledge of the codebase

Inspectind stack trace you can find the line that causes exception. So you can wrap this come with try/catch and pus breakpoint to catch.


You should declare a project debuggable in the AndroidManifest.xml Second, the debugger should have a break point where you wan't to inspect the code. When starting the project in debugger in eclipse, the view will automatically jump to debugger as it hits a break point.

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜