249

Why doesn't logcat show anything in my Android (while developing apps with Eclipse)?

It just doesn't print anything. It's empty.

Karthik P
  • 481
  • 5
  • 9
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
  • 3
    Is it the logcat View in Eclipse that's blank, the output of the `adb logcat` command, or both? – David Webb Feb 12 '10 at 08:10
  • It may also happen when debugging Android 7 (or higher) devices. [See this topic](http://stackoverflow.com/questions/39351106/eclipse-empty-logcat-with-android-7) – Geoffrey VL Jan 27 '17 at 11:32
  • What do you mean by *"in my Android"*? Do you mean *"on my Android device"*? Or *"in Android Studio"*? Or something else? Please respond by [editing (changing) your question](https://stackoverflow.com/posts/2250112/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the question should appear as if it was written today). – Peter Mortensen Aug 30 '21 at 21:23

29 Answers29

521

I had this same issue but my fix was much more basic:

If the LogCat panel is empty in Eclipse the emulator doesn't have the focus. Go to the DDMS perspective and try clicking on the 'emulator' entry in the Devices panel (top-left screen).

MoMo
  • 8,149
  • 3
  • 35
  • 31
  • 66
    Same thing happens with a physical device. You just have to click on the entry representing that device and the log messages suddenly come flooding in. – Tyler Jul 13 '10 at 04:10
  • 25
    If this doesn't work right away, restart eclipse, then it works, thanks @MoMo – Sam Sussman Jan 05 '12 at 17:07
  • 1
    On my target device, it showed my activity, click on it and then click on **Start Tracking** on the next window. – Radu Mar 27 '12 at 16:25
  • from last month I restart the eclipse as solution, you make it more faster :) – daksh21ubuntu Jun 24 '13 at 11:11
  • I have no idea where the "device tab" is supposed to be - someone has a picture? – newnewbie Sep 21 '14 at 21:20
  • **Window** / **Show View** / **Other...** / **Devices**. I've just upvoted this answer to 500. ;-) – Quip11 Jul 29 '15 at 18:56
  • @Tyler 12 years later and I have the same problem but this time clicking on the entry representing that (physical) device does not solve the issue. OTOH, every now and then I see all LogCat messages in one single long line. Could the problem be my el-cheapo Redmi 6A phone? – WebViewer Dec 06 '22 at 14:27
83

Dial

*#*#2846579#*#*

and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).

Please note this may apply to Huawei phones only as is stated for an Ideos X3 (here) and is tested at a Honor U8860.

Pang
  • 9,564
  • 146
  • 81
  • 122
denispyr
  • 1,403
  • 3
  • 21
  • 34
71

If clicking in Devices panel doesn't bring the spam, use reset adb in dropout menu from triangle on the right of the snapshot button.

Fyodor
  • 2,793
  • 4
  • 21
  • 24
  • 2
    Watch out because Console will spit out [YYYY-MM-DD HH:MM:SS - DeviceMonitor] Adb connection Error:EOF... Connection attempts: 1. As posted elsewhere on SO (http://stackoverflow.com/questions/1997474/android-eclipse-plugin-reset-adb-gives-adb-connection-erroreof-error-not-b), this is benign but you will have to unplug/reconnect your devices so they show up. – paulrehkugler Nov 30 '12 at 19:27
  • This fixed it, and I didn't have to reconnect my device for it to show up, fwiw – Achal Dave Oct 29 '13 at 03:50
  • Just found it, but I only get message that Adb connection was forcebly close and no reconnection. – Johnny_D Feb 09 '14 at 23:10
41

I have the same problem on/off and the way I solved is by menu FileRestart (restart Eclipse).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nick Kahn
  • 19,652
  • 91
  • 275
  • 406
33

Maybe you have Mylyn installed?

http://code.google.com/p/android/issues/detail?id=1808

Nikola Smiljanić
  • 26,745
  • 6
  • 48
  • 60
11

While the answer provided by MoMo will resolve the problem temporarily it will most likely reoccur the next time you launch Eclipse, or launch on a different Emulator/Device.

Instead of always having to select my device in the devices view I've found a better solution is to go into your Eclipse preferences and navigate to Android -> LogCat in the list on the left and then enable "Monitor logcat for messages from applications in workspace".

This way no matter what device you are using logcat will automatically start showing output from it as soon as the application launches.

It will also setup a filter that ensures that only output from your application is displayed, which you can reuse / disable as needed.

Logcat application output enabling setting

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Justin Buser
  • 2,813
  • 25
  • 32
10

Maybe the log is not enabled in your device. Try to run the following command.

adb shell
echo 1 > /sys/kernel/logger/log_main/enable
Roland
  • 1,109
  • 13
  • 15
6

OK. This is how I got it to work. I first followed MoMo's advice, that is...

If the LogCat panel is empty in Eclipse the emulator doesn't have the focus. Go to the DDMS perspective and try clicking on the 'emulator' entry in the Devices panel (top-left screen).

But to no avail.

I then attempted to reset adb (Android Debug Bridge) as suggested by fyodorananiev. How? Menu WindowDevices → upside down triangle menu button → Reset adb.

It also didn't work, but I did get the following message:

Android hierarchyviewer: Unable to get the focused window from device

This meant that MoMo was right in that my Android device or emulator didn't have focus. However, the solution I did in my case is different.

What worked for me:

  1. Replugged my Android device, which was connected to my computer via USB.

  2. Restarted Eclipse, as mentioned by Abu Hamzah (although since I didn't know I can do menu FileRestart, I manually closed down Eclipse, and then restarted the application again.)

I can now see logs in my logcat.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
masarapmabuhay
  • 466
  • 1
  • 9
  • 15
  • What worked for you is waaaay too cumbersome and time consuming. It used to work for me without a hitch on a Nexsus One and LG LS670 and Samsung Galaxy S. I have no idea what happened the current state of Eclipse+ADT development (other than that it is no longer supported by Google). – WebViewer Dec 06 '22 at 14:44
3

If you are using a device, the simplest check is to restart Eclipse.

You don't have to shutdown Eclipse

Use menu FileRestart

In a quick second or two you should see your LogCat return.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
seth yount
  • 132
  • 6
3

Go to Developer settings and check that for Debugging\Select App for Debugging is empty

enter image description here

Henadzi Rabkin
  • 6,834
  • 3
  • 32
  • 39
2

The simplest solution worked for me: Shutdown and restart my phone and Eclipse alike.

Chris Lacy
  • 4,222
  • 3
  • 35
  • 33
2

I think you haven't selected the device or emulator, on which running your application.

In Eclipse, go to DDMS Perspective and select the device or emulator on which you are running your application.

(Note: No need to restart Eclipse)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mahesh
  • 2,862
  • 2
  • 31
  • 41
2

It gets interesting when you find out that none of all the answers in for this question were helpful.

And then you find out that in your version of ADT 22.6.3.v201404151837-1123206 if you add two filters with the same package name (application name) then the log will not appear.

It was weird, because the log was there two seconds ago, and launching the app in debug mode adds a default filter for the app which collides with the filter I've setup manually, and then ADT magically removes all the logs, and none of the filter worked including the all messages (no filters)!

But it was masking another issue...

I'm working with dual screens. The second one is connected via VGA/RGB - (not really sure what it's called) and what can I do. I'm a ton more comfortable with the logcat away from my code editors, so I've placed it in another window, and as it turns out that is the main reason for the disappearing logs for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
TacB0sS
  • 10,106
  • 12
  • 75
  • 118
2

In case if you are using CyanogenMod in your mobile, it will disable logging by default. Try this method:

In your device, open "/system/etc/init.d/" folder If there are many files, try opening each file and find for this line:

rm /dev/log/main

Now, comment this line like this: # rm /dev/log/main

Save the file and reboot.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jaswanth Kumar
  • 3,531
  • 3
  • 23
  • 26
2

I had faced the same issue but in my case logs are shown when other devices are connected and not shown when my device is connected.

It took me days and finally, the issue resolved when I restarted my phone.

Srikar Reddy
  • 3,650
  • 4
  • 36
  • 58
2

Below: Really dumb answer, but it happens!

My cat stepped on the space button while I was away and [SPACE]xN was typed in the search bar.

That resulted in an empty Log Cat. I tried restarting and wasted like 1 hour before I realized I should clear my search bar.

TLDR; CLEAR YOUR LOG CAT SEARCH BAR!

enter image description here

Pavle37
  • 571
  • 9
  • 24
1

If using the DDMS to refocus doesn't work, try closing and restarting LogCat. That helped me.

lorless
  • 4,126
  • 8
  • 30
  • 41
1

I've had this happen occasionally. Closing and re-opening Eclipse seems to fix it.

Lars
  • 9,976
  • 4
  • 34
  • 40
1

If you tried all of the others, and still got losing on an empty logcat. I got another simple way.

Download an old version of ADB, and try again. It might be working, at least working for me with Android 7.0 phone (vendor stopped updating).

Here is the useful link for old versions.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tokenyet
  • 4,063
  • 2
  • 27
  • 43
0

Check if the Console is telling you something. Usually this happens when the project could not be installed in the device, and just shows the previous one.

The most common case I have seen this is when there are different signatures in the project, and is not running at all. Please, read all the red letters you see. If the LogCat does not show anything, take for sure that the Console will do.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sterling Diaz
  • 3,789
  • 2
  • 31
  • 35
0

I had the same issue. No need to restart Eclipse or clean your project. You may follow:

  1. Click on LogCat icon on bottom right corner of eclipse.
  2. In Saved Filter Pane (Left side), double click package of your project (in my case it's com.apps..*).
  3. In Logcate Message Filter Settings popup, select desired option of "by Log Level". You can select verbose, info, error etc.
  4. Click Ok.
  5. Run/Debug your project.
Wasif Hamdani
  • 118
  • 11
0

What worked for me besides restarting Eclipse was:

  • Remove custom filters

After removing all filters, logcat was filled with text again

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
sam
  • 4,357
  • 5
  • 29
  • 34
0

Close logcat and then reopen it from WindowShow ViewOthers.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

If you're using Eclipse v4.5 (Mars) (at least, Mars.1 or Mars.2), try the solution described here: Logcat show invisible messages in Eclipse Mars.

It helped in my case.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
0

This is simple.

Just close the Logcat from eclipse.

Then reopen it by following steps in Eclipse.

Window - Show View - Other - Android - LogCat - ok

Hope this solves your problem.

DevGo
  • 1,045
  • 1
  • 16
  • 42
0

Set the same date and time in your Android phone and in your laptop.

I had a similar problem of logs not showing, and when I set the correct date in the phone I started seeing the logs (I restarted the phone and the hour was completely wrong!).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marc Cayuela
  • 1,504
  • 13
  • 26
0

Many times when I switched to a new Android device, I do see no more logcat messages. Unfortunately, none of the above suggestions worked for me (Eclipse Photon 4.8.0).

I am now using this . It seems to work for different devices.

AMRAY
  • 21
  • 3
0

For OnePlus devices and Ubuntu OS:

  • Install Wine on Ubuntu

  • Install ADB tools on Ubuntu

     sudo apt-get install android-tools-adb
    
  • Now, attach your device to PC with USB.

  • Open mounted "One Plus Drivers". A disc like icon

  • Right click on OnePlus_USB_Drivers_setup.exe and run with Wine

  • Then open the terminal in the present drive where your "OnePlus_USB_Drivers_setup.exe" and other driver files exists. And run

     ./adb_config_Linux_OSX.sh or sh adb_config_Linux_OSX.sh
    
  • Close this terminal

  • Open a new terminal and run

     adb server-start
    

Your OnePlus device should prompt you to recognise your PC as a debugging agent.

Now, run on the terminal. It should show your device.

adb devices

Reference: [SOLVED] Android Studio does not recognise my One Plus Two in Linux

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
wittyurchin
  • 301
  • 5
  • 7
0

In my case (after trying all the answers provided here to no avail), the problem (and solution) has to do with port 8700:

enter image description here

What I needed to do is:

  1. Exit "Android Device Monitor" (monitor.bat)
  2. Exit all instances of Eclipse.
  3. C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe kill-server
  4. C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe start-server
  5. C:\adt-bundle-windows-x86_64\sdk\tools> monitor.bat

Also, the Scroll Lock button, needs to be "pressed/active":

logcat scrolling

Not the other way:

logcat paused

WebViewer
  • 761
  • 7
  • 21