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

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


当前回答

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

其他回答

就我而言,我试图用其他答案来解决这个问题,但没有结果。我无意中发现,空标签几乎从未显示(Android Studio 1.4)。因此,尝试在TAG中放入任何字母(空格无效)。

Log.wtf("x", "Android Studio Team, solve this, please!");

还要小心这个坏男孩(即使重新启动android studio也没有消失):

为我禁用验证应用程序通过USB和验证字节码 可调试的应用程序帮助我使logcat更加可靠。

在我的例子中,我从右边的小下拉列表中删除了“image”。在那之后一切都很好。这是因为它将在日志中搜索搜索框中的关键字,因此如果没有找到任何匹配项,它将返回空白

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

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行为,突出显示您调试和开发所需的行和语法。 从现在开始,您需要通过调试窗口访问它。