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

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


当前回答

一些自定义rom出于性能原因禁用日志记录(尽可能压缩%)检查rom的内置应用程序或调整rom的菜单来启用此功能。

我在我的i9505上运行贵山的Galaxy S4 Rom,我不知道它默认禁用了日志记录,以获得最分钟的性能提升,但显然这在定制的“性能”导向型Rom上并不罕见。我花了一段时间才发现这一点-非常烦人,因为它会显示我有多少消息被记录,而不是他们的细节。

其他回答

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

在android Studio应用程序中,您需要单击调试应用程序选项(Shift+f9)以调试模式运行并启用LogCat。

这不是一个技术性的答案,但您可能想要检查logcat的搜索框。如果输入了任何字符,你的logcat将为空,因为它将搜索特定的字符或单词,然后如果它不存在,你的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行为,突出显示您调试和开发所需的行和语法。 从现在开始,您需要通过调试窗口访问它。

对我来说,它不仅适用于我的应用程序,它正在工作,如果没有选择过滤器(右侧的选项)。但我只需要看到我的应用程序,因此我发现,如果我做我自己的过滤器,过滤它的包名,它是工作,因为它应该。我希望它也能帮助到你:)