小编use*_*347的帖子

Eclipse Android调试器 - 我的代码在哪里导致异常?

不可否认,我的问题与此问题基本相同,但似乎没有答案:

handleStopActivity中的NullPointerException - 在堆栈跟踪中没有对我的代码的引用

在上周内下载了Eclipse Helios,Android Developer Tools插件和JDK.我正在搞乱我的设备上的应用程序,在调试模式下运行它,它意外终止.我意识到我已经导致了NullPointerException并且问题本身不是很长时间的问题.

然而,问题是调试器似乎无法识别我的代码中抛出异常的位置.堆栈跟踪不引用我的代码.

实际上,如果我在OnCreate()方法中加入以下内容,我会遇到同样的问题

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    //lI("onCreate()");  //A silly logging thing I messed around with

    Integer iDareYou = null;
    iDareYou.byteValue();
Run Code Online (Sandbox Code Playgroud)

值得赞扬的是,Eclipse当然警告我,代码可能会在我脸上爆炸.但是当我在我的设备上实际运行它时,返回的堆栈跟踪如下:

Thread [<1> main] (Suspended (exception RuntimeException))  
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2787  
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2803   
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 135 
ActivityThread$H.handleMessage(Message) line: 2136  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 144 
ActivityThread.main(String[]) line: 4937    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: …
Run Code Online (Sandbox Code Playgroud)

eclipse debugging android

15
推荐指数
1
解决办法
3836
查看次数

标签 统计

android ×1

debugging ×1

eclipse ×1