我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
当前回答
对我来说,它不仅适用于我的应用程序,它正在工作,如果没有选择过滤器(右侧的选项)。但我只需要看到我的应用程序,因此我发现,如果我做我自己的过滤器,过滤它的包名,它是工作,因为它应该。我希望它也能帮助到你:)
其他回答
我尝试了上面的建议。然而,没有一个成功。然后我做了下面的事情,结果出乎意料地奏效了:
断开设备的USB接口 使用adb tcpip 5555和adb connect <device ip>命令通过Wi-Fi连接设备 使用adb kill-server断开设备与adb的连接 通过USB重新连接设备
然后LogCat显示日志。尽管在第2步时日志可用,但以下步骤在通过USB连接时为我解决了这个问题。
在Android Studio 0.8.9中,我打开Android设备监视器,从设备列表中选择模拟器,并在LogCat选项卡中获得输出。
之后,我回到Android Studio的主视图,在Android DDMS选项卡的右侧选择Restore Logcat视图,它就在那里!
如果这不起作用,你可以在Android设备监视器中看到你的日志猫,就像我在第一句话中解释的那样。
Logcat的右边有一个小图标。您可以使用该图标打开和关闭logcat。我通常可以通过单击图标(可能几次)使logcat激活。
修复一些不必要的更改的最佳方法是使缓存无效
转到FILE ->,单击“INVALIDATE CACHES/RESTART”,然后弹出一个对话框, 选择“无效缓存/重新启动”按钮。
Android studio将自动重新启动并重新构建索引。
Easy fix that worked for me (after trying some of these other suggestion). My logcat was sitting blank in a separate window (on my second screen). Just had to drag the Logcat tab back to it's original place in the debug panel next to the Debugger and Console tabs, and VOILA... it began immediately updating and showing all processes verbose. So (If your logcat is anywhere outside of the debugger panel (i.e. the logcat tab isn't sitting nested alongside the debugger and console tab) then it won't receive updates and will sit there blankly. Don't know if this is an issue with older versions of Android Studio. But again, easy to try and if it works... it works!!