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

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


当前回答

Windows用户:

使用脚本工具。确保您已经为系统设置了ADB环境。 Android Logcat脚本

保存到bat文件 编辑文件。用包id替换com.example.abc 双击打开文件或通过MobaXTerm打开(方便查找文本)

p/s:如果这个答案有帮助,让我们把我的回购星。谢谢!

其他回答

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

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!!

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

确保您导入了正确的类

import android.util.Log;

这些帮助了我:

1.启用ADB集成 2. 进入Android设备监视器 检查您的设备是否在线,并创建所需的过滤器