我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
当前回答
尝试点击“Android”视图最右边的图标,你应该在Android视图上看到Logcat选项卡(你可以通过按Alt+6打开Android视图)
其他回答
对我来说,问题在于设备是在“仅充电”模式下连接的。
将模式更改为媒体设备(MTP)(或在某些设备中传输文件)解决了问题。
这可能不是你的问题,但我发现当Android Studio打开多个窗口时,logcat只指向其中一个,而不一定是正在运行活动应用程序的那个。
例如,窗口1是我开发一字棋应用程序的地方,窗口2是我开发天气应用程序的地方。如果我在调试模式下运行天气应用程序,可能只有窗口1能够显示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.
修复一些不必要的更改的最佳方法是使缓存无效
转到FILE ->,单击“INVALIDATE CACHES/RESTART”,然后弹出一个对话框, 选择“无效缓存/重新启动”按钮。
Android studio将自动重新启动并重新构建索引。
尝试点击“Android”视图最右边的图标,你应该在Android视图上看到Logcat选项卡(你可以通过按Alt+6打开Android视图)