Eclipse Android Debugger - Where in my code did I cause the exception?

后端 未结 4 1738
长情又很酷
长情又很酷 2021-02-13 06:38

Admittedly, my question is basically the same as this one, but it seems to have been left unanswered:

NullPointerException in handleStopActivity -- No reference to my co

相关标签:
4条回答
  • 2021-02-13 06:38

    In my experience, Android eats up the exceptions caused when inflating a layout. It should certainly report the exception, but apparently some Android developer sadly decided to catch it and create a new one -- without adding the former as cause. I view it as a deficiency of the Android environment; as it can be hard to reach the Android team I have lived with it until now, but I would report it to Google if it really bothered me.

    0 讨论(0)
  • 2021-02-13 06:58

    iDareYou.byteValue();

    Calling this on a Null-Value is causing the problem if you want to convert I recommend trying out this: Сonverting int to byte in android

    0 讨论(0)
  • 2021-02-13 06:59

    I ran your exact code and LogCat gave me the following exceptions:

    Caused by: java.lang.NullPointerException
        at mypackage.test.TestActivity.onCreate(TestActivity.java:23)
    

    Of course it is the

    iDareYou.byteValue();

    statement. This is clear as a bright day!

    I suggest that you must learn how to use Dalvik Debug Monitor Server in the proper way.

    The log you posted seems pretty useless, did you messed up some of the LogCat filters(it happened to me once)?

    OFFTOPIC: "Where in my code did I cause the exception?" - I think that your question is not well formulated.

    I think that proper name of this question might be - 'How to use Android debugger and LogCat? Some exceptions are not logged properly!'

    0 讨论(0)
  • 2021-02-13 07:03

    In Eclipse the Android SDK provides several views. On of it is called "LogCat". There you can find the exception stack traces

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