Somewhat of a noob question but in analyzing the stacktrace am i correct in assuming that the first or topmost item in a stacktrace is the most recent? And in my case is 'performDestroyActivity' the cause OR the result of a crash?
What should be the next steps in debugging the cause of my crash?
This is my BugSense report
java.lang.RuntimeException: Unable to destroy activity {ca.foo.awesomeapp/ca.foo.awesomeapp.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3497)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3515)
at android.app.ActivityThread.access$1400(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1249)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException
at com.wiley.wroxaccessories.WroxAccessory.disconnect(WroxAccessory.java:79)
at ca.foo.awesomeapp.MainActivity.onDestroy(MainActivity.java:179)
at android.app.Activity.performDestroy(Activity.java:5403)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3484)
... 11 more
First, logcat appends lines to the bottom of the file. So the bottommost stacktrace is the most recent. The topmost is the first to occur (with the "most recent" being the last to occur).
To analyze a stacktrace, basically start by reading each line until you see an object from your app. Within the stacktrace the topmost line with your app info is the "root" cause of the crash, while your app may contain objects that were inherited or called by your line (or inherited method's lines) of code.
In your case, this is your culprit:
at ca.foo.awesomeapp.MainActivity.onDestroy(MainActivity.java:179)
That should tell you that on line 179 of "MainActivity" inside the "onDestroy" method, you are calling something that resulted in a null pointer exception. The line directly above it tells you where it occurred before it hit your code - the "WroxAccessory" - which appears to have a null object in it, and that's where it stops. Otherwise, you would see more lines about this line:
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException
That's the main "looper" holding your app. So above that is usually not helpful (because it's extremely unlikely to be a bug in there, but that code is running also and executing your code, so it's a part of the trace).