捕获的 Throwable 或 Exception 为空

Gan*_*nus 6 java eclipse debugging null android

类似的问题在这里被问了两次,从来没有任何答案。或者答案是:“不可能!” 对不起,可能太多了:

try{
    ...
    // the line that causes the error
    LinearLayout cell = (LinearLayout) inflater.inflate(R.layout.channels_list_cell, column);
    ...
}
catch(Throwable e){
    Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); < breakpoint here!
}
Run Code Online (Sandbox Code Playgroud)

在断点处 e 为空。请问我该如何查找错误?很可能不是java或Android的问题,而是Eclipse调试器的问题,本身就需要调试。但是,除了更改为不同的 IDE 之外,我还能做什么?有任何想法吗?先谢过。

我尝试过 Throwable、Exception、RuntimeException。结果是一样的。

尝试越过断点会导致 NullPointerException,因此,此时 e 似乎真的为空。哪里会丢?

编辑:我对每个人表示感谢,对每个回答者都表示 +1。这是一个 Eclipse 错误。重新启动 Eclipse 后,异常不再为空,它是一个正常的 RuntimeException: Binary XML file line #15: You must provide a layout_width 属性。这将是另一个需要解决的问题,但这个问题已经解决了。

Ade*_*ros 1

Android并不总是在Throwable. 它实际上驱动了所有异常catLog。在那里,您将找到异常的详细信息,即使在 catch 块中您的异常null

您可以轻松地从 eclipse 和过滤器访问catlog控制台以仅查看错误

更新:

您的断点应该位于 catch 块内