views:

568

answers:

3

how/where can I see what happened when my Android application crashes in Eclipse (using Run, not Debug)?

+8  A: 

Window -> Show View -> Other, then select Android / LogCat

aioobe
or you could go into the debug or DDMS perspective :)
Ravi Vyas
I got an error window in my application: "The application....has stopped unexpectedly. Please try again", but LogCat is empty...
jul
@jul Make sure that correct device is selected in Devices view
Nikolay Ivanov
Sometimes the logcat view will get a hiccup and delete all new content after some lines. It helps to click the clear console button with the red cross after that the new content will be shown correctly.
Janusz
+3  A: 

Sometimes the device gets "out of sync" with eclipse and logcat doesn't show any messages, as you've discovered.

To fix this, try a) closing the logcat tab and creating a new one; b) disconnecting your device and reconnecting it; c) exiting eclipse and restarting it; d) rebooting your device; or e) rebooting your computer, in that order. Usually the problem is fixed by the time you've done c).

Edward Falk
usually it's enough to re-select the device in the device list.
aioobe
sometimes the emulator will not show up in the device list. The only way to correct this that I know is to restart the emulator.
Janusz
To expand on what aioobe said; go to DDMS and select the device. That usually fixes the problem.
Edward Falk
+1  A: 

I found Eclipse not very reliable and switched to IntelliJ, much happier that way. IntelliJ 9 supports Android development (not the community edition though). Beside Eclipse DDMS, you can also see the logcat from the command line. Open a shell and change to the folder of your Android SDK, and here to subfolder 'tools'. There you can run

adb shell logcat

which will show you the log.

If you want to explicit distinguish between real device or emulator (in case you're using both), you can add parameters -d or -e

Device:

adb -d logcat

Emulator:

adb -e logcat
Mathias Lin
You can remove 'shell' from each of those commands.
Christopher
Yes, you're right. I edited it.
Mathias Lin