How can I see the error log (logcat) for Android in Eclipse?
Asked Answered
C

3

15

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

Conifer answered 19/5, 2010 at 14:43 Comment(0)
M
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).

Masker answered 19/5, 2010 at 16:40 Comment(4)
usually it's enough to re-select the device in the device list.Farmann
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.Subjunction
To expand on what aioobe said; go to DDMS and select the device. That usually fixes the problem.Masker
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 <mytag>:D" usually works very well for me.Masker
F
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.)

Farmann answered 19/5, 2010 at 14:45 Comment(4)
or you could go into the debug or DDMS perspective :)Myself
I got an error window in my application: "The application....has stopped unexpectedly. Please try again", but LogCat is empty...Conifer
@Conifer Make sure that correct device is selected in Devices viewMusquash
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.Subjunction
M
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).

Masker answered 19/5, 2010 at 16:40 Comment(4)
usually it's enough to re-select the device in the device list.Farmann
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.Subjunction
To expand on what aioobe said; go to DDMS and select the device. That usually fixes the problem.Masker
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 <mytag>:D" usually works very well for me.Masker
P
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
Pneuma answered 19/5, 2010 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.