tags:

views:

130

answers:

3

Even explicitly writing e.printStackTrace() it doesn't print to the console, why?

+4  A: 

Checkout Logcat in DDMS perspective it should be there not in the Console tab.

Or use the ddms command tool to read logcat.

alt text

Pentium10
with the ddms it will print to the console, like in the plain old java development?
Tom Brito
No, never will print to the console.
Pentium10
If you're testing on hardware, there's a free app (aLogcat) that works pretty well for viewing the logs of your phone without having to be attached to DDMS.
kiswa
@Tom Brito: "with the ddms it will print to the console, like in the plain old java development?" No, no more than running a Java GUI on a remote machine will print to your local machine's console in "plain old java development". Remember: your phone and your development PC are two distinct pieces of hardware. There is a LogCat tab in Eclipse (shown above), or a standalone DDMS. If you absolutely need to see LogCat output in a terminal window somewhere, use `adb logcat`. And consider using `android.util.Log` instead of `printStackTrace()`.
CommonsWare
+1  A: 

printStackTrace() doesn't print to the console, it prints to the standard error stream. If you want to print to the screen, set your display text to e.getMessage() or e.getStackTrace(). (Although I do recommend learning to debug with logcat instead.)

Bill the Lizard
+1  A: 

use Log.X() where X is the type of error console you want(Log.e, Log.v, Log.d, etc.)

Nicholas