tags:

views:

313

answers:

2

I think I must be missing something really basic here, but if my program dies, DDMS doesn't tell me which line it died on - all the stack references are inside the Android source code giving "source not found" errors.

If anyone can help, I would really appreciate it, as Anroid is driving me crazy.

Thanks!

A: 

I've just seen that errors are reported in the LogCat window, rather than showing a stack trace of the actual running program.

Wow, this is the most confusing SDK I've ever used in my life!

Jumbo
LogCat reports the Java stack trace of the exception from your now-crashed activity. This is not significantly different than Java dumping the stack trace of the exception from your now-crashed application to the console. If you are new to Java development, I definitely recommend spending a few weeks working in Java outside of Android to get comfortable with stack traces and such before diving into Android itself.
CommonsWare
Thanks very much for your answer. :)I was expecting it to show the stacktrace in the Eclipse window (where it shows the stacktrace of the Android OS) not in the LogCat - which is also quite full of other stuff - as this has been the case in other Eclipse extensions I've used.I was also expecting the SDK to be able to show me in my code where the exception has occured rather than lots of "source not found" errors relating to the Android source code. It doesn't seem very elegant or useful do do this.Maybe this is a modification I can make to the SDK if it's open-source.Thanks again!
Jumbo
+2  A: 

Be sure you look at the complete stack crawl -- there will often be one or more "caused by" clauses, showing where inner exceptions were thrown before being caught by the framework (and rethrown). So your actual application code may be buried down after a "caused by:" line.

If there are absolutely no lines of your app's code in the stack crawl, then either your app is doing something that is causing the framework to throw an exception after returning from its code, or you are just hitting a bug in the framework. Either way, supplying the actual full error and stack crawl that is being printed to the log is needed to be able to help you further.

Also as far as DDMS vs. logcat -- the DDMS output view is just another client of the same log, showing the same information as "logcat" just formatted a little differently (and with interactive filtering options etc).

hackbod