开发者

Is there a way to break into the debugger on exception in Android emulator?

Assuming I didn't start in debug mode, is there a way to make the eclipse debugger automatically start if my app throws an exception inside the emulator?

Alternatively, is there a way to get a more useful error message out of the emulator (som开发者_开发问答ething more useful than "Sorry, your app terminated unexpectedly").


I don't know how to trigger the debugger, but did you look at the stack trace when the error occurred, either in Eclipse DDMS (if it was already running) or using the "adb logcat" command?

https://developer.android.com/studio/debug/index.html


Yes, there is a button to add a Java exception breakpoint from the Breakpoints view in the Eclipse Debug perspective. See here for further details:

http://help.eclipse.org/galileo/topic/org.eclipse.jdt.doc.user/reference/views/breakpoints/ref-addexception_viewaction.htm

The emulator is emulating a real Android device. There is little point in displaying stack traces to an end user, hence the generic message. Use the LogCat view in the DDMS perspective.


Looks like you can almost do this in the DDMS perspective via the "Debug Process" button. It still won't break on demand if you aren't already in debug mode. And it's too late to debug if you're already looking at the "force close" dialog.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜