How can I debug this NullPointer exception?

后端 未结 7 1613
南方客
南方客 2020-12-28 19:49

I\'m trying to write an application for Android and when I launch my new activity, I\'ve set break points and found that it runs through my onCreate without any errors, but

相关标签:
7条回答
  • 2020-12-28 20:14

    I was wondering this myself, and even though it showed the "caused by" in the LogCat, I wanted the debugger to actually break where the NullPointer exception was thrown (even though it was being caught).

    Here's how:

    1. Run -> Add Java Exception Breakpoint
    2. Find NullPointerException (or whatever else you might be debugging (the "Caused by" exception)
    3. Make sure Suspend On Caught Exceptions is checked. Click OK.
    4. You should see a new breakpoint in your view

    Try running it now, and the debugger should break where it actually occurs.

    0 讨论(0)
提交回复
热议问题