什么使 Android Eclipse LogCat 成为可能?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3458156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:16:57  来源:igfitidea点击:

What enables the Android Eclipse LogCat?

androideclipselogcat

提问by Hymannad

The LogCat window is open. Sometimes LogCat displays Log messages, sometimes it does not, with or without the physical target attached. Is there an enable/disable Log somewhere in the debug environment?

LogCat 窗口已打开。有时 LogCat 显示日志消息,有时不显示,无论是否附加了物理目标。调试环境中是否有启用/禁用日志?

采纳答案by Aaron C

I also have this problem within Eclipse. If you are lucky enough to not care about what has already been written to LogCat, you can click the "Clear Log" button on the top right next to the V,D,I,W,E buttons.

我在 Eclipse 中也有这个问题。如果您足够幸运,不关心已写入 LogCat 的内容,您可以单击 V、D、I、W、E 按钮旁边右上角的“清除日志”按钮。

If you select the device and clear the log, I've found that the output is stable (at least until it fills up again).

如果您选择设备并清除日志,我发现输出是稳定的(至少在它再次填满之前)。

回答by Juliano

I was having the same problem when trying to show logs on LogCat using the emulator. I solved this selecting "Reset adb" on the "Device" tab of DDMS.

我在尝试使用模拟器在 LogCat 上显示日志时遇到了同样的问题。我在 DDMS 的“设备”选项卡上选择“重置 adb”解决了这个问题。

回答by Dhiral Pandya

type this :

输入:

adb kill-server
adb start-server
adb logcat

adb kill-server
adb start-server
adb logcat

回答by Erwan

There is a known bug with logcat on Eclipse, it could be what you're experiencing: http://code.google.com/p/android/issues/detail?id=2752

Eclipse 上的 logcat 存在一个已知错误,这可能是您遇到的问题:http: //code.google.com/p/android/issues/detail?id=2752

A suggested solution is to unplug the device and clear the logs, then start again

建议的解决方案是拔下设备并清除日志,然后重新启动

回答by mdeudon

This happens to me when I work on an emulator and also my phone plug to the computer. My phone's log do not show on logcat. To solve the problem I close the emulator.

当我在模拟器上工作并将手机插头连接到计算机时,就会发生这种情况。我的手机日志没有显示在 logcat 上。为了解决这个问题,我关闭了模拟器。

回答by Jeremy Haberman

To disable the LogCat view from automatically appearing, deselect the following in Preferences:

要禁用 LogCat 视图自动出现,请在首选项中取消选择以下选项:

Android > LogCat > Display logcat view when there are messages from an application in the workspace

Android > LogCat > 当工作区中有来自应用程序的消息时显示 logcat 视图

回答by Ani

If changing the Log level does not displays the log messages, close the debug perspective and then reopen it using the shortcut key or (Window -> Open Perspective -> debug), in Eclipse. This should surely resolve the issue of missing log messages.

如果更改日志级别未显示日志消息,请关闭调试透视图,然后在 Eclipse 中使用快捷键或 (Window -> Open Perspective -> debug) 重新打开它。这肯定可以解决丢失日志消息的问题。

cheers

干杯

回答by ahmad

click on DDMS then click on debug button (the bug icon next to run button)

单击 DDMS,然后单击调试按钮(运行按钮旁边的错误图标)

回答by codinguser

I usually have this problem too. I found that what happens is that the LogCat is clearing the view as fast as the log messages are coming in, so I can't see anything.

我也经常有这个问题。我发现发生的情况是 LogCat 清除视图的速度与输入日志消息的速度一样快,因此我什么也看不到。

What helped me was to change the log level. e.g. if it was at Debug, change to Verbose and then back to Debug. LogCat returns to normal and allows the logs to persist.

帮助我的是更改日志级别。例如,如果它处于调试状态,请更改为详细,然后返回调试。LogCat 恢复正常并允许日志保留。

That worked for me, but YMMV.

这对我有用,但是 YMMV。

P.S. Also check that your device is actually connected and 'online'. Sometimes, the device can go offline and LogCat can't print anything then.

PS还要检查您的设备是否已实际连接并“在线”。有时,设备会脱机,LogCat 无法打印任何内容。

回答by Daniel Gruici

To start, I am running Eclipse Indigo on a Mac OSX 10.7.4.

首先,我在 Mac OSX 10.7.4 上运行 Eclipse Indigo。

To keep the Logcat from dying and having to restart Eclipse each time I have been pausing Logcat and then right clicking and quitting the emulator from the dock. This does not work if you pause and click the close button in the emulator window.

为了防止 Logcat 在每次我暂停 Logcat 然后右键单击并从 Dock 退出模拟器时都必须重新启动 Eclipse。如果您暂停并单击模拟器窗口中的关闭按钮,这将不起作用。

Once the emulator is started again, unpause the Logcat and it seems to function properly. Make sure that the app has loaded completely, as shown by Console, before you close the window otherwise this does not work.

再次启动模拟器后,取消暂停 Logcat,它似乎可以正常运行。在关闭窗口之前,请确保应用程序已完全加载,如控制台所示,否则这将不起作用。

I have not figured out why this works yet. I have not had the chance to test this on my Windows machine.

我还没有弄清楚为什么这行得通。我还没有机会在我的 Windows 机器上测试这个。