I installed Android Studio yesterday, and I tried to use the LogCat to see the logs. But there is nothing to show in the logcat. I used the terminal to run ./adb logcat
and it works.
昨天我安装了Android Studio,我尝试使用LogCat查看日志。但是没有什么可看的。我使用终端运行。/adb logcat和它工作。
Is there someone who can explain to me how to use logcat in Android Studio?
有没有人能告诉我怎么在Android Studio中使用logcat ?
345
Restarting logcat helps me always.
重启logcat帮助了我。
104
I get into this state often. Logcat is blank. Debugging works, I can hit breakpoints. No filters are set. Log level is on Verbose. I fix it by repeatedly looping through the following:
我经常处于这种状态。Logcat是空白。调试工作正常,我可以达到断点。没有设置过滤器。日志级别是详细的。我通过以下循环来修复它:
adb kill-server && adb start-server
ddms
on the command line.And finally restarting the computer if all else fails.
如果其他方法都失败了,最后重新启动计算机。
The problem is intermittent, I think Android Studio is just buggy.
问题是断断续续的,我认为Android Studio只是有问题。
51
You need to press Alt+6
twice to restart the logcat window. That way it'll show the log outputs.
您需要按Alt+6两次来重新启动logcat窗口。这样就会显示日志输出。
The problem mainly happens in debug mode.
问题主要发生在调试模式下。
51
I had the same problem but I solved by the following steps, Try this once.
我也遇到过同样的问题,但是我通过以下步骤解决了,请尝试一次。
1) In the android studio.
1)在android studio中。
2) Open android Monitor window(bottom of android studio)
2)打开android Monitor窗口(android studio底部)
3) You can see the drop down in the right corner(spinner)
3)你可以看到右下角的下坠(转轮)
4) select -- Show only Selected application.
4) select——只显示选定的应用程序。
35
These helped me :
这些帮助我:
1.Enable ADB integration 2. Go to Android Device Monitor Check if your device is online and Create a required filter
1。使亚行集成2。进入Android设备监视器检查你的设备是否在线,并创建一个必需的过滤器
19
Best way to fix some unnecessary changes is to invalidate caches
修复一些不必要的更改的最佳方法是使缓存无效。
Go to FILE -> click "INVALIDATE CACHES/RESTART" then a dialog box will pop-up, Select "INVALIDATE CACHES/RESTART" button.
转到FILE ->点击“INVALIDATE cache /RESTART”,弹出对话框,选择“INVALIDATE cache /RESTART”按钮。
Android studio will automatically restart and rebuild the index.
Android studio将自动重新启动和重建索引。
16
In android Studio application you need to click Debug application option (Shift+f9) to run in debug mode and to enable LogCat.
在android Studio应用程序中,需要单击Debug应用程序选项(Shift+f9)以在调试模式下运行并启用LogCat。
11
Not a technical answer but you might want to check the search box for the logcat. If there is any character inputted, your logcat will be empty as it will be searching for that certain character or word, and then if its not present, your logcat log will be totally empty.
这不是一个技术性的答案,但是您可能想要检查logcat的搜索框。如果有任何字符输入,您的logcat将为空,因为它将搜索特定的字符或单词,然后如果它不存在,您的logcat日志将完全为空。
8
**
* *
**
* *
I've just solved this after MONTHS of annoyment and trouble.
Nothing helped, the device monitor worked fine during debugging but the standard logcat view was always empty.
我刚刚解决了几个月的烦恼和麻烦。没有任何帮助,设备监视器在调试期间运行良好,但是标准的logcat视图总是空的。
The reason was annoyingly simple:
The logcat view was there but it had been moved to 0 width by an update!
原因非常简单:logcat视图在那里,但是通过更新将它的宽度移动到0。
You are in "ALT 6" Tab, you see two tabs in there "ADB logs" and "Devices | logcat"
Devices | logcat really means that it consists of Devices AND logcat, split by a vertical border.
The vertical border can be moved and during an update it seems to have moved to 100% right.
在ALT 6选项卡中,有两个选项卡"ADB log "和" device | logcat"设备| logcat实际上是指它由设备和logcat组成,由垂直边框分割。可以移动垂直边框,在更新过程中,它似乎已经向右移动了100%。
This results in the logcat to be collected but not displayed, move your mouse pointer to the right of the tool window and just DRAG logcat back into view.
这将导致logcat被收集但不显示,将鼠标指针移动到工具窗口的右边,并将logcat拖回到视图中。
This solution won't help everyone but I found many people with working ADB connection and still no logcat output, those might be hit by the same problem.
这个解决方案不会对每个人都有帮助,但是我发现很多人有工作的ADB连接,但是仍然没有logcat输出,这些人可能会遇到同样的问题。
7
Try to close the project and re-open it .It worked for me. Logs will be reappear.
试着关闭这个项目并重新打开它,它对我有用。日志将会出现。
7
For me, the issue was that I had two emulators with the same name (I created it, deleted it, and then created it again with the same name). There were two emulator entries in the logcat dropdown and it was connected to the wrong one. All I had to do was switch to the other one. I prevented the problem permanently by renaming the emulator.
对我来说,问题是我有两个同名的模拟器(我创建了它,删除了它,然后又用相同的名字创建了它)。logcat下拉菜单中有两个模拟器条目,它连接到错误的那个。我所要做的就是换到另一个。通过重新命名仿真器,我永久地避免了这个问题。
7
Restarting Android Studio helped me.
重启Android Studio对我有帮助。
5
In my case, I removed "image" from the little dropdown on the right. It showed up just fine after that. That's because it will be searching the log for the keyword in that searchbox, so if it doesn't find any matches, it returns blank
在我的例子中,我从右边的小下拉菜单中删除了“image”。在那之后一切都很好。这是因为它将在那个搜索框中搜索日志中的关键字,所以如果没有找到任何匹配项,它将返回空
4
On the right side of tab "Devices logcat" there is the button "Show only Logcat from selected Process". Its not perfect, because everytime I run another process I need to push it again, but thats the only solution that works for me. So far...
在标签“设备logcat”右侧,有一个按钮“只显示来自选定进程的logcat”。它并不完美,因为每次我运行另一个进程时,我都需要再次推动它,但这是唯一适合我的解决方案。到目前为止…
4
In my case, in the developer options menu there is an option called
在我的例子中,在developer options菜单中有一个选项叫做
Revoke USB debugging authorisations
.
撤销USB调试授权。
Once you revoke all the existing authorisations it will ask again to trust the computer that you are using after that it started to show the logs again.
一旦您撤销了所有现有的授权,它将再次请求信任您正在使用的计算机,然后它开始再次显示日志。
3
This may not be your issue, but I've found that when having multiple windows of Android Studio open, logcat is only directed to one of them, and not necessarily the one that's running an active application.
这可能不是您的问题,但我发现,当打开Android Studio的多个窗口时,logcat只指向其中一个窗口,而不一定是运行活动应用程序的那个窗口。
For example, Window 1 is where I'm developing a Tic-Tac-Toe app, and Window 2 is where I'm developing a weather app. If I run the weather app in debug mode, it's possible only Window 1 will be able to display logcat entries.
例如,窗口1是我开发一个井字游戏应用程序的地方,窗口2是我开发一个天气应用程序的地方。
3
In my case I just had filtered the output so it appeared empty even after restarting Logcat etc.
在我的例子中,我只是过滤了输出,所以即使在重新启动Logcat之后,输出也是空的。
2
In Android studio 0.8.0 you should enable ADB integration through Tools -> Android, before run your app. Then the log cat will work correctly. Notice that if you make ADB integration disabled while your app is running and again make it enable, then the log cat dosen't show anything unless you rebuild your project.
在Android studio 0.8.0中,在运行应用程序之前,您应该通过工具> Android支持ADB集成。注意,如果在应用程序运行时禁用ADB集成,并再次启用它,那么日志cat不会显示任何内容,除非您重新构建项目。
2
In Android Studio 0.8.9, I opened Android Device Monitor, selected my emulator from the Devices list and got the output in the LogCat tab.
在Android Studio 0.8.9中,我打开Android设备监视器,从设备列表中选择模拟器,并在LogCat选项卡中获取输出。
After that, I went back to the main view of Android Studio and selected Restore Logcat view in the right of the Android DDMS tab and there it was!
之后,我回到Android Studio的主视图,在Android DDMS选项卡的右边选择了Restore Logcat视图,就在那里!
If this doesn't work, you could see your logcat in the Android Device Monitor as I explained in the first sentence.
如果这不起作用,您可以在Android设备监视器中看到logcat,正如我在第一句话中解释的那样。
2
Had the same issue today.
今天也有同样的问题。
Apparently I had eclipse running too and all the logcat output was redirected to eclipse. Since the logs can only be shown at once place, make sure you dont have multiple debuggers running.
显然,我也有eclipse运行,所有的logcat输出都被重定向到eclipse。因为日志只能显示在一个地方,所以要确保没有多个调试器在运行。
2
My problem solved, after I add android:debuggable="true" under application in your AndroiManifest.xml (even the ide mark as a wrong syntax!????)
我的问题解决了,当我添加android:debuggable="true"在你的android系统中。xml(甚至ide标记都是错误的语法!???)
1
Logcat has a little icon to the right of logcat. You can use the icon to turn logcat on and off. I can usually make logcat active by clicking the icon (maybe several times).
Logcat的右边有一个小图标。你可以使用这个图标来打开和关闭logcat。我通常可以通过点击图标来激活logcat(可能是几次)。
1
Full nuclear solution. ONLY USE THIS AFTER TRYING EVERYTHING ELSE because this will erase all your settings and preferences as well as stored images and everything that makes your emulators run until you reinstall and reconfigure. In my case it took about 20 minutes for both steps because I didn't customise a lot except for using Darcula.
完整的核解决方案。只有在尝试了所有其他东西之后才使用它,因为这将删除所有设置和首选项,以及存储的映像和所有使模拟器运行的内容,直到重新安装和重新配置。在我的例子中,这两个步骤都花了大约20分钟,因为除了使用Darcula之外,我没有定制很多东西。
For linux users this is found under /home/[username]/.AndroidStudioBeta
For windows users, I'm not sure. The documentation on it is rather vague in my opinion. Probably somewhere under C:\Users[your user]\Application Data
对于linux用户,这是在/home/[用户名]/中找到的。我不确定windows用户的安卓系统。在我看来,关于它的文件相当模糊。可能在C:\用户[您的用户]\应用程序数据下面
Rather drastic but I tried all the other things on this page, connected device, no filters, restarting the service, everything on this page and it just didn't work.
相当激烈,但我尝试了这个页面上所有其他的东西,连接设备,没有过滤器,重新启动服务,这个页面上的所有东西,它就是不能工作。
1
For me it was not working only for my application, it was working, if no filter has been selected (option on right side). But I needed to see only my app, therefore I found out, that if I do my own filter and filter it to package name, it is working as it should. I hope it could help to you too : )
对于我来说,它不仅适用于我的应用程序,如果没有选择过滤器(右边的选项),它还可以工作。但我只需要看到我的应用,因此我发现,如果我做我自己的过滤器,过滤它到包名,它就会正常工作。我希望这对你也有帮助。
1
Make sure you have enabled the build variant to "debug" in the Build Variants context menu. (You can find this at the bottom left corner of the window). This option will be set to release mode, if you have signed the apk for the application previously. This causes the debug messages not to show in the log cat.
请确保在build variant上下文菜单中启用了构建变体“debug”。(你可以在窗口左下角找到这个)。如果您之前已经为应用程序签了apk,那么这个选项将被设置为发布模式。这会导致调试消息不显示在log cat中。
1
Easy fix that worked for me (after trying some of these other suggestion). My logcat was sitting blank in a separate window (on my second screen). Just had to drag the Logcat tab back to it's original place in the debug panel next to the Debugger and Console tabs, and VOILA... it began immediately updating and showing all processes verbose. So (If your logcat is anywhere outside of the debugger panel (i.e. the logcat tab isn't sitting nested alongside the debugger and console tab) then it won't receive updates and will sit there blankly. Don't know if this is an issue with older versions of Android Studio. But again, easy to try and if it works... it works!!
在尝试了一些其他的建议之后,这个简单的修复对我很有效。我的logcat在另一个窗口(在我的第二个屏幕上)空着。只需将Logcat选项卡拖回到调试面板中调试和控制台选项卡旁边的原始位置,然后……它立即开始更新并显示所有进程的详细信息。因此(如果您的logcat位于调试器面板之外的任何位置(例如,logcat选项卡没有嵌套在调试器和控制台选项卡旁边),那么它将不会接收更新,并将空白地坐在那里。不知道这是不是老版本的Android Studio的问题。但是,很容易尝试,如果可行的话…它的工作原理!
1
Make sure you are importing the right class
确保导入了正确的类
import android.util.Log;
1
Go to run->debug If incase you have lose connection with host, it will ask permission to reconnect. Click yes. That should do it.
运行->调试如果你已经失去了与主机的连接,它将请求重新连接的权限。单击yes。应该做的。
1
I had the same symptoms but my problem was way simpler and really my mistake. I had the wrong filter set.
我也有同样的症状,但我的问题更简单,而且是我的错误。我设置了错误的过滤器。
The solution was just to verify that I had the correct filter set.
解决方案是验证我有正确的过滤器集。
1
I just fixed it on mine. Look for tiny icons on the far right of the DDMS display which restore the Devices Logcat view and the ADB View.
我刚把它固定在我的上面。在DDMS显示的最右边寻找小图标,它可以恢复设备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.
当DDMS首次同时显示“ADB日志”和“设备| logcat”选项卡时。“设备| logcat”是应该显示设备输出的,但是是空白的。不知何故,我设法隐藏了其中的一个或另一个标签,我完全忘记了如何隐藏。但是,在右边有一个小图标写着“恢复ADB”视图,我点击它,它就出现了。还有一个小图标是“恢复设备logcat视图”。我点击了它,突然它出现了,并再次显示设备输出。