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

瘦欲@ 提交于 2019-11-27 17:38:10

问题


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


回答1:


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).




回答2:


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



(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.)




回答3:


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


来源:https://stackoverflow.com/questions/2866565/how-can-i-see-the-error-log-logcat-for-android-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!