15

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

aioobe
  • 383,660
  • 99
  • 774
  • 796
jul
  • 33,288
  • 64
  • 178
  • 299

3 Answers3

37

Window → Show View → Other, then select Android / LogCat



enter image description here enter image description here

(If you already see the view, but it doesn't seem to show the correct / up-to-date output, try reselecting the desired device in the devices view.)

aioobe
  • 383,660
  • 99
  • 774
  • 796
  • or you could go into the debug or DDMS perspective :) – Ravi Vyas May 19 '10 at 14:57
  • I got an error window in my application: "The application....has stopped unexpectedly. Please try again", but LogCat is empty... – jul May 19 '10 at 15:01
  • 3
    @jul Make sure that correct device is selected in Devices view – Nikolay Ivanov May 19 '10 at 15:33
  • 1
    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 May 20 '10 at 07:09
20

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) going to DDMS and selecting your device; b) closing the logcat tab and creating a new one; c) disconnecting your device and reconnecting it; d) exiting eclipse and restarting it; e) rebooting your device; or f) rebooting your computer, in that order. Usually the problem is fixed by the time you've done a).

Edward Falk
  • 9,578
  • 8
  • 66
  • 105
  • 3
    usually it's enough to re-select the device in the device list. – aioobe May 19 '10 at 21:23
  • 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 May 20 '10 at 07:08
  • To expand on what aioobe said; go to DDMS and select the device. That usually fixes the problem. – Edward Falk Jul 19 '10 at 20:32
  • I'm going to make another note here: I don't really like the new version of logcat because the messages tend to scroll away. Lately, I've become very fond of running logcat from the command line: "adb logcat -s :D" usually works very well for me. – Edward Falk Sep 29 '12 at 15:44
2

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 Conradt
  • 27,904
  • 20
  • 132
  • 186