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

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


当前回答

修复一些不必要的更改的最佳方法是使缓存无效

转到FILE ->,单击“INVALIDATE CACHES/RESTART”,然后弹出一个对话框, 选择“无效缓存/重新启动”按钮。

Android studio将自动重新启动并重新构建索引。

其他回答

在Android 3.6.1中,我必须:

升级到最新的Android Studio版本(4.x.x) 重启Logcat 重启应用程序 重启Android Studio 重新启动Android测试设备

需要连续两次按“Alt+6”重新启动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.

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

执行->debug命令 如果你失去了与主机的连接,它会要求重新连接。单击yes。这样就行了。