我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。

有人能给我解释一下如何在Android Studio中使用logcat吗?


当前回答

这不是一个技术性的答案,但您可能想要检查logcat的搜索框。如果输入了任何字符,你的logcat将为空,因为它将搜索特定的字符或单词,然后如果它不存在,你的logcat日志将完全为空。

其他回答

在我的例子中,它通过TCP连接断开,即使设备出现了。

调用

adb connect <device ip>

重启logcat OK。

需要连续两次按“Alt+6”重新启动logcat窗口。这样它就会显示日志输出。

问题主要发生在调试模式。

所有这些都无济于事,我的日志猫功能失常。

After a lot of angry searching I found a solution that seems to work: 1. Make sure logcat itself is working (use DDMS from Tools->Android) and if it does close DDMS window again 2. Now go to Tab 5 (Debug), there select Logcat (this is not the same logcat as in Window 6!) 3. The window is empty just like Window 6, but now start a debugging run. For me logcat in the Debug window now started to show all the stuff again! Also when normally running the application the Debug->logcat view is still functional while the Tool Window #6 "logcat" is disfunctional as before

这是一个黑客,但是它会导致正常的logcat行为,突出显示您调试和开发所需的行和语法。 从现在开始,您需要通过调试窗口访问它。

奇怪的是,即使是在最近版本的Android Studio上,仍然会遇到这个问题。我通读了一长串的解决方案,但它们对我不起作用。 接受的答案适用于早期版本的Android Studio(我猜是v2.3)

我做了以下让Logcat再次工作:

Logcat >只显示选中的应用>不显示过滤器

Logcat >不过滤>只显示选中的应用

我期望重置logcat应该理想地给我同样的效果,但它没有。手动切换滤镜是唯一有效的方法。

这是在Android Studio 3.0.1(稳定)(我不能在完成当前项目之前更新它) 问题发生在我早上启动Android工作室继续我晚上留下的工作时。我希望开发人员能研究一下这个问题。从stackoverflow中尝试了超过15个解决方案,仍然没有看到任何结果。为这个问题的未来受害者揭示另一种解决方案甚至令人恼火。

我刚刚更改了applictionId和logcat停止工作。要重置它,您必须更改包的名称。只需点击右上角的下拉在Logcat窗口,显示你的应用程序包的名称,点击它,然后点击编辑过滤器配置,现在改变包的名称。它将开始工作。