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

有人能给我解释一下如何在Android Studio中使用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.

其他回答

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

确保在模拟器开发人员菜单选项中有记录器缓冲区大小适当值。

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

调用

adb connect <device ip>

重启logcat OK。

重新启动logcat。它是固定的

试试@Robert Karl在这篇文章中提到的观点。如果没有工作,那么你肯定可以通过android设备监视器看到日志。

启动android设备监视器 选择DDMS透视图 然后选择屏幕截图所示的设备。 您可以根据您的要求应用过滤器