Logcat 在 android studio 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21238451/
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
Logcat doesn't work in android studio
提问by user3178137
I use android studio 0.4.2 and logcat
does not work (its just empty). USB debugging is enabled, filters are disabled and log level is verbose. Any ideas?
我使用 android studio 0.4.2 并且logcat
不起作用(它只是空的)。USB 调试已启用,过滤器已禁用,日志级别为详细。有任何想法吗?
回答by moo5e
In logcat, try going to the bottom right corner where there is a ">>" and select that. It restarts it.
在 logcat 中,尝试转到右下角有“>>”的位置并选择它。它重新启动它。
回答by iflp
Click on the "Debug App" Icon next to the "Run App" Icon or press SHIFT + F9. That seems to do the trick for me.
单击“运行应用程序”图标旁边的“调试应用程序”图标或按 SHIFT + F9。这似乎对我有用。
回答by ElectronicGeek
Try going to developer settings on the phone, and scrolling to the "Monitoring" then "Enable OpenGL Traces" and select LogCat.
尝试转到手机上的开发人员设置,然后滚动到“监控”然后“启用 OpenGL 跟踪”并选择 LogCat。
回答by Eduardo Po?o
I tried everything. I unintentionally found that empty tags never show. If you are using empty tags, like me, try filling with some letter (blank spaces didn't work for me).
我尝试了一切。我无意中发现空标签永远不会显示。如果您像我一样使用空标签,请尝试填充一些字母(空格对我不起作用)。
回答by Md Imran Choudhury
On your android monitor:
在你的安卓显示器上:
- Restart your LogCat.
- Set no filters because Android studio 2.2 has Firebase.
- Clear your searching filter.
- Select your running device.
- 重新启动您的 LogCat。
- 不设置过滤器,因为 Android studio 2.2 有 Firebase。
- 清除您的搜索过滤器。
- 选择您的跑步设备。
If not work clear Android studio caches. File->invalidate caches/restart
如果不起作用,请清除 Android Studio 缓存。文件-> 使缓存无效/重新启动
When apply all way but still not working then use Android device monitor. Tools -> Android -> Android device monitor.
当全部应用但仍然无法正常工作时,请使用 Android 设备监视器。工具 -> Android -> Android 设备监视器。
回答by Abidemi Kusimo
In my case, restarting Android Studio works for me.
就我而言,重新启动 Android Studio 对我有用。
回答by Brian
In my case, I had two Android phones plugged in for debugging. Switching phones, using the drop down box, didn't do a thing, so I:
就我而言,我插入了两部 Android 手机进行调试。切换电话,使用下拉框,没有做任何事情,所以我:
-unplugged both
- 拔掉两者
-restarted Android Studio (and the project)
- 重新启动 Android Studio(和项目)
-plugged in the (one) device for which I wanted to see the logs
- 插入我想查看日志的(一个)设备
That did it for me. Logs were back ... now just to fix the code.
那是为我做的。日志回来了......现在只是为了修复代码。
回答by Ewan
In case you make it down here, @Maarten's comment above worked for me. Close Android Studio then adb devices
at Ubuntu terminal:
如果你在这里成功,@Maarten 上面的评论对我有用。关闭 Android Studio,然后adb devices
在 Ubuntu 终端:
ewan@xxxx:~/AndroidStudioProjects/projectx$ adb devices
List of devices attached
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
FA7Bxxxxxx2 device
ewan@xxxx:~/AndroidStudioProjects/projectx$ adb devices
List of devices attached
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
FA7Bxxxxxx2 device
Restarted Android Studio and logcat window worked again.
重新启动 Android Studio 和 logcat 窗口再次工作。
UPDATE: d'oh I found that I was inadvertently using version 39 from the terminal window whereas Android Studio was using 41
更新:哦,我发现我在终端窗口中无意中使用了 39 版,而 Android Studio 使用的是 41 版
回答by José Maurício
I had the same problem and solved it in the device developer options by disabling and enabling Usb debugging.
我遇到了同样的问题,并通过禁用和启用 Usb 调试在设备开发人员选项中解决了它。
回答by denizen
To add to this thread of solutions,
要添加到此解决方案线程中,
- Check for if you have multiple devices connected. Than select the device that you want logs from (upper left corner on logcat window). Sometimes, different device is selected rather than one you are debugging your app on. Hope this helps.
- 检查您是否连接了多个设备。然后选择您想要记录的设备(logcat 窗口的左上角)。有时,会选择不同的设备,而不是您正在调试应用程序的设备。希望这可以帮助。