简体   繁体   English

Android-发生崩溃,但堆栈跟踪未说明发生的位置

[英]Android - crash occurs but the stack trace does not say where it happened

I have a null pointer exception somewhere, but I am not sure where. 我在某处有一个空指针异常,但是我不确定在哪里。 All I have is this error: 我只有这个错误:

java.lang.NullPointerException
        at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:330)
        at android.widget.AdapterView.checkFocus(AdapterView.java:700)
        at android.widget.AdapterView$AdapterDataSetObserver.onInvalidated(AdapterView.java:823)
        at android.widget.AbsListView$AdapterDataSetObserver.onInvalidated(AbsListView.java:5738)
        at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java:47)
        at android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java:59)
        at android.widget.ArrayAdapter$ArrayFilter.publishResults(ArrayAdapter.java:513)
        at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:282)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4697)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
        at dalvik.system.NativeStart.main(Native Method)

Would anyone have any ideas for how to debug this? 会有人对如何进行调试有任何想法吗? I have not been able to reproduce it. 我无法复制它。 It just sometimes happens and shows up in my crash logs. 它只是有时发生,并显示在我的崩溃日志中。

Thanks! 谢谢!

Here's the code for ArrayAdapter: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/ArrayAdapter.java . 这是ArrayAdapter的代码: https : //github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/ArrayAdapter.java

Assuming this is the right version, an NPE on line 330 would be caused if the adapter's dataset (ie the backing list or array) is null. 假设这是正确的版本,如果适配器的数据集(即后备列表或数组)为空,则会在第330行引起NPE。

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM