我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
当前回答
试试@Robert Karl在这篇文章中提到的观点。如果没有工作,那么你肯定可以通过android设备监视器看到日志。
启动android设备监视器 选择DDMS透视图 然后选择屏幕截图所示的设备。 您可以根据您的要求应用过滤器
其他回答
这偶尔发生在我使用模拟器。我只需插入一个设备并运行应用程序。Logcat就可以继续工作,当我回到模拟器时它也可以这样做。 我想只要切换两个设备和/或模拟器就可以了。
在android Studio应用程序中,您需要单击调试应用程序选项(Shift+f9)以调试模式运行并启用LogCat。
所有这些都无济于事,我的日志猫功能失常。
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行为,突出显示您调试和开发所需的行和语法。 从现在开始,您需要通过调试窗口访问它。
对我来说,它不仅适用于我的应用程序,它正在工作,如果没有选择过滤器(右侧的选项)。但我只需要看到我的应用程序,因此我发现,如果我做我自己的过滤器,过滤它的包名,它是工作,因为它应该。我希望它也能帮助到你:)
这些帮助了我:
1.启用ADB集成 2. 进入Android设备监视器 检查您的设备是否在线,并创建所需的过滤器