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

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


当前回答

我的手机上有一个自定义ROM,由于某种原因没有输出logcat,但是模拟器和另一个设备可以输出。擦除并安装ROM使logcat重新工作。

其他回答

我刚把它修好了。在DDMS显示的最右边寻找恢复Devices Logcat视图和ADB视图的小图标。

When the DDMS first came up with both the "ADB Logs" and the "Devices | logcat" tab showing. The "Devices | logcat" is the one that should be showing the device output, but was blank. Somehow I managed to hide one or the other of those tabs, I forget exactly how. But, off to the right there was a tiny icon that said "Restore ADB" view, and I clicked it and it came up. Then there was another tiny icon that said "Restore Devices logcat view". I clicked that, and all of a sudden it appeared and was showing the device output again.

重新启动Android Studio帮助了我。

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

调用

adb connect <device ip>

重启logcat OK。

Logcat的右边有一个小图标。您可以使用该图标打开和关闭logcat。我通常可以通过单击图标(可能几次)使logcat激活。

在我的情况下,我只是过滤了输出,所以即使在重新启动Logcat等后,它也显示为空。