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

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


当前回答

为我禁用验证应用程序通过USB和验证字节码 可调试的应用程序帮助我使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.

我有同样的症状,但我的问题要简单得多,这真的是我的错误。我的滤镜设置错了。

解决方案只是验证我设置了正确的过滤器。

试试@Robert Karl在这篇文章中提到的观点。如果没有工作,那么你肯定可以通过android设备监视器看到日志。

启动android设备监视器 选择DDMS透视图 然后选择屏幕截图所示的设备。 您可以根据您的要求应用过滤器

如果同时使用多个版本的adb, Logcat可能会失败。一个在Android Studio,一个在终端。

你可能有不同版本的adb: sudo apt-get install android-tools-adb将创建/usr/bin/adb Android SDK包含{Android - SDK}/platform-tools/adb, 或者从创建/host/linux-x86/bin/adb的AOSP构建的输出

要查看这个问题是否影响到你,使用“Help -> Show Log in Files”打开idea.log,并寻找类似于“Initializing adb using:/home/repkap11/android-sdk/platform-tools/adb”的行。将此路径与终端中的“which adb”进行比较。如果它们不匹配,这个问题就会影响到您。

Android studio寻找{Android -sdk}/platform-tools/adb,并不关心你的PATH。我用符号链接替换了android-sdk中的adb版本,但简单地“sudo apt-get remove android-tools-adb”也可以。

就我而言,我试图用其他答案来解决这个问题,但没有结果。我无意中发现,空标签几乎从未显示(Android Studio 1.4)。因此,尝试在TAG中放入任何字母(空格无效)。

Log.wtf("x", "Android Studio Team, solve this, please!");