我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
当前回答
步骤1:连接你的手机与Android开发者选项和USB调试。
步骤2:进入“查看>工具窗口> Logcat”
第三步:在运行项目之前,确保你的手机连接Android Studio。然后运行应用
注意:如果不能显示Logcat,请重新启动Android Studio: File > Invalid Caches/ Restart
其他回答
所有这些都无济于事,我的日志猫功能失常。
After a lot of angry searching I found a solution that seems to work: 1. Make sure logcat itself is working (use DDMS from Tools->Android) and if it does close DDMS window again 2. Now go to Tab 5 (Debug), there select Logcat (this is not the same logcat as in Window 6!) 3. The window is empty just like Window 6, but now start a debugging run. For me logcat in the Debug window now started to show all the stuff again! Also when normally running the application the Debug->logcat view is still functional while the Tool Window #6 "logcat" is disfunctional as before
这是一个黑客,但是它会导致正常的logcat行为,突出显示您调试和开发所需的行和语法。 从现在开始,您需要通过调试窗口访问它。
我经常陷入这种状态。Logcat为空。调试工作,我可以击中断点。没有设置过滤器。日志级别为“Verbose”。我通过以下反复循环来修复它:
重新启动logcat(参见上面Zatziky的回答) 将日志级别更改为Debug(或其他级别),然后返回Verbose。 拔下并插回设备 运行adb kill-server && adb start-server 关闭Android Studio并在命令行上启动ddms。 重启Android Studio
最后,如果一切都失败了,重新启动计算机。
这个问题是间歇性的,我认为Android Studio就是有bug。
我的手机上有一个自定义ROM,由于某种原因没有输出logcat,但是模拟器和另一个设备可以输出。擦除并安装ROM使logcat重新工作。
在Android 3.6.1中,我必须:
升级到最新的Android Studio版本(4.x.x) 重启Logcat 重启应用程序 重启Android Studio 重新启动Android测试设备
重新启动Android Studio帮助了我。