Java Android Studio logcat 不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28815356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android studio logcat not working
提问by squiroid
There is very awkward thing I am facing logcat is shown in debugging application but while running(not debugging) application it is not showing logcat .
我面临的非常尴尬的事情是 logcat 显示在调试应用程序中,但是在运行(不调试)应用程序时它没有显示 logcat 。
I tried restart it but nothing is happening.
我尝试重新启动它,但没有任何反应。
采纳答案by Cletus Ajibade
In my case in Android 2.2, for some reason, Firebase was selected by default in the dropdown box marked above. So logs didn't drop. I just needed to change it to No Filters
. Then it worked.
就我而言,在 Android 2.2 中,出于某种原因,默认情况下在上面标记的下拉框中选择了 Firebase。所以日志没有下降。我只需要将其更改为No Filters
. 然后它起作用了。
I even tried restarting the logcat, that didn't work too. No Filters
did the magic.
我什至尝试重新启动 logcat,这也不起作用。No Filters
魔法。
Hope this helps someone.
希望这可以帮助某人。
Edit:
You can as well select Show only selected application
for logcat to show only the current debugging process, i.e your app.
编辑:您也可以选择Show only selected application
logcat 以仅显示当前的调试过程,即您的应用程序。
回答by Tristan Wiley
You may be hiding it, try pressing Alt + 6to open Log tab.
Look at the log level:- it must be verbose.
Restart adb.
If that doesn't works restart the android studio.
您可能隐藏了它,请尝试按Alt + 6打开日志选项卡。
查看日志级别:-它必须是详细的。
重启亚行。
如果这不起作用,请重新启动 android studio。
回答by Clive Sargeant
I found the following worked for me.
我发现以下对我有用。
First, my problem: i was testing an app on a Samsung Galaxy A3 attached via usb cable. I was getting the usual logCat messages, including the filtered ones then all of a sudden the logCat stopped displaying filtered messages. Setting it to Verbose displayed a continues stream of messages with a mesage at the top left corner of the lagCat stating "too much output to display".
首先,我的问题:我正在通过 USB 电缆连接的三星 Galaxy A3 上测试应用程序。我收到了通常的 logCat 消息,包括过滤的消息,然后突然之间 logCat 停止显示过滤的消息。将其设置为 Verbose 会显示一个连续的消息流,在 lagCat 的左上角显示一条消息,说明“输出太多无法显示”。
I tried restarting Android Studio (with and without clearing the cache) but no luck. I then rebooted my phone and everything was back to normal. So it appeared that the attached phone was the problem, sending too much info to the logCat.
我尝试重新启动 Android Studio(清除和不清除缓存),但没有成功。然后我重新启动了我的手机,一切都恢复了正常。所以看起来连接的电话是问题所在,向 logCat 发送了太多信息。
Hope this helps someone.
希望这可以帮助某人。
回答by Kapil Bhagia
I had this code:
我有这个代码:
Log.e(getMyName(),message);
The problem with this was, the variable that the getter method was accessing was null. Android Studio did not give me any error about it! Seems this was silently not letting the Log.e statement to work. I checked many blogs but couldn't find the solution. This small miss wasted my complete one hour. Hope this helps someone.
问题在于,getter 方法访问的变量为空。Android Studio 没有给我任何错误!似乎这是默默地不让 Log.e 语句起作用。我查了很多博客,但找不到解决方案。这个小失误浪费了我整整一个小时。希望这可以帮助某人。
回答by Peter Loane
Check you don't have something in the logcat search that returns no matches, for example a non existent package name.
检查您在 logcat 搜索中没有不返回匹配项的内容,例如不存在的包名称。
I had renamed my packages, but left an old name in the logcat search field. Result: No logcat output visible
我重命名了我的包,但在 logcat 搜索字段中留下了一个旧名称。结果:没有可见的 logcat 输出
回答by Andrew
I tried to switch "Extended log" in my device settings from "Selectivly" to "Allowed" and it helped. Now debug info appears in LogCat.
我尝试将设备设置中的“扩展日志”从“选择性”切换到“允许”,它有所帮助。现在调试信息出现在 LogCat 中。
回答by Ehsan.sarshar
on The top left of logcat there is an option to choose the emulator. may it's not selected the current emulator by default. try to changing it to current emulator and it will fix.
在 logcat 的左上角有一个选择模拟器的选项。可能默认情况下它没有选择当前的模拟器。尝试将其更改为当前模拟器,它将修复。
回答by Mehrdad Salimi
回答by JcDelaCueva
I fixed the issue by changing the USB Options of my phone from "Charging only" to "Transfer files (MTP)"
我通过将手机的 USB 选项从“仅充电”更改为“传输文件 (MTP)”解决了该问题
回答by Aakib Jabbar
i had the kind of issue the way which got me the logcat to work was that i was notchoosing the right filter.as i was using sqlite(Database) and in filters i had choosen firebase.so that's why my logcat was not working
我有一个问题,让我使用 logcat 的方式是我没有选择正确的过滤器。因为我使用的是 sqlite(Database) 并且在过滤器中我选择了 firebase.so 这就是为什么我的 logcat 不工作