问题描述
再次调试我的Android应用程序时,我已经打了一个砖墙。
Once again I've hit a brick wall when debugging my android application.
这个问题通常,当你在你的活动启动code错误表现。
This problem usually manifests when you have errors in the startup code of your activity.
在这种情况下,我的自定义SurfaceView类的构造函数的地方后,我得到这个不值钱的文字psented $ P $:
In this case, somewhere after the constructor of my custom SurfaceView class I get presented with this worthless text:
Thread [<3> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2596
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2621
ActivityThread.access$2200(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 126
ActivityThread$H.handleMessage(Message) line: 1932
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4603
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 860
ZygoteInit.main(String[]) line: 618
NativeStart.main(String[]) line: not available [native method]
这当然不会有什么与我的code。
Which of course doesn't have anything to do with my code.
我甚至试图通过我的code的每一行踏步,但这个错误的某处发生在方法调用之间。
I've even tried to stepping through each line of my code, but this error happens somewhere in between the method calls.
我敢肯定,这是一个简单的错误,但事实上,调试器的行为像这是一个重大的烦恼,我知道的一个事实我会打多个错误。
I'm sure this is a simple error, but the fact that the debugger acts like this is a major annoyance and I know for a fact I will hit more of these errors.
感谢。
编辑:
我发现这个问题。一个简单的空引用。现在的问题仍然是,虽然,为什么不能调试器告诉我这个NullPointerException异常?
I found the problem. A simple null reference. The question remain though, why couldn't the debugger show me this nullpointerexception?
推荐答案
我觉得你的痛苦。我所知道的唯一方式就是让程序继续进行强制关闭,然后读取日志中的logcat的窗格中。这似乎在所有code从事件通过本机层,据我可以告诉是刚才的一切传下来这就是所谓的发生。
I feel your pain. The only way I know of is to let the program continue and force close, then read the log in the logcat pane. This appears to happen in all code which is called from an event passed down through the native layer, which as far as I can tell is just about everything.
我第一次让程序崩溃,然后读取日志弄清楚哪里放一个断点,然后重新启动应用程序,并在断点处检查值。这是非常令人沮丧的。
I first let the program crash, then read the log to figure out where to put a breakpoint, then restart the app and inspect the values at the breakpoint. This is extremely frustrating.
这篇关于为什么不能在Android调试提供有用的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!