Android studio logcat nothing to show

匿名 (未验证) 提交于 2019-12-03 02:11:02

问题:

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.

Is there someone who can explain to me how to use logcat in Android Studio?

回答1:

Restarting logcat helps me always.



回答2:

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:

  • Restart logcat (see Zatziky's answer above)
  • Change the log level to Debug (or anything else) and back to Verbose.
  • unplugging and plugging back in the device
  • running adb kill-server && adb start-server
  • Close Android Studio and launch ddms on the command line.
  • Restart Android Studio

And finally restarting the computer if all else fails.

The problem is intermittent, I think Android Studio is just buggy.



回答3:

You need to press Alt+6 twice to restart the logcat window. That way it'll show the log outputs.

The problem mainly happens in debug mode.



回答4:

I had the same problem but I solved by the following steps, Try this once.

1) In the android studio.

2) Open android Monitor window(bottom of android studio)

3) You can see the drop down in the right corner(spinner)

4) select -- Show only Selected application.



回答5:

These helped me :

1.Enable ADB integration

2. Go to Android Device Monitor Check if your device is online and Create a required filter



回答6:

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.

Android studio will automatically restart and rebuild the index.



回答7:

In android Studio application you need to click Debug application option (Shift+f9) to run in debug mode and to enable LogCat.



回答8:

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.



回答9:

**

  • Read this if you are still stuck with logcat being empty

**

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.

The reason was annoyingly simple:
The logcat view was there but it had been moved to 0 width by an update!

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.

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.

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.



回答10:


Try to close the project and re-open it .It worked for me. Logs will be reappear.



回答11:

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.



回答12:

Restarting android studio helped me.



回答13:

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



回答14:

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...



回答15:

In my case, in the developer options menu there is an option called

Revoke USB debugging authorisations.

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.



回答16:

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.

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.



回答17:

In my case I just had filtered the output so it appeared empty even after restarting Logcat etc.



回答18:

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.



回答19:

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.

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!

If this doesn't work, you could see your logcat in the Android Device Monitor as I explained in the first sentence.



回答20:

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.



回答21:

My problem solved, after I add android:debuggable="true" under application in your AndroiManifest.xml (even the ide mark as a wrong syntax!????)



回答22:

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).



回答23:

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.

  1. Delete your .AndroidStudioBeta config files directory

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

  1. Check to see if it works yet, if it doesn't then also reinstall the SDK.

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.



回答24:

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 : )



回答25:

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.



回答26:

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!!



回答27:

Make sure you are importing the right class

import android.util.Log;


回答28:

Go to run->debug If incase you have lose connection with host, it will ask permission to reconnect. Click yes. That should do it.



回答29:

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.



回答30:

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.

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!