[android] Why doesn't logcat show anything in my Android?

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

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

This question is related to android eclipse logging logcat

The answer is


For one plus 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 terminal in the present drive where your these "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 termianl and run

    adb server-start

Your one plus device should prompt you to recognise your pc as a dubugging agent. Now, run on terminal. It should show your device.

adb devices

Reference :- https://forums.oneplus.com/threads/solved-android-studio-does-not-recognise-my-one-plus-two-in-linux.365221/#post-13208160


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

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

(Note: No need to restart the Eclipse)


If you're using Eclipse 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.


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.


I have the same problem on/off and the way I solved is by File>>Restart (restart the eclipse)


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


It gets interesting when you find out that NONE of ALL THE ANSWERS in this thread 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 log, and NONE of the filter worked including the All messages(no filters)!

I hope I saved someone some time... I was at it for almost an hour.

==== UPDATE ====

And then I spent another short while figuring that this was masking another issue...

I'm working with dual screens, the second one is connected via VGA/RGB - (not really sure how its 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.


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


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

enter image description here


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


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.


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

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


In case if you are using cynogenmod 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.


Check if the Console is telling you something. Usually this happen when the project could not be install in the device, and just show the previous one. The most common case I has seen this is when there are different signatures in the project, and is not running at all. Please, read all red letter you see. If the LogCat does not show anything, take for sure that the Console will do.


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


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

** you don't have to shutdown eclipse **

use File > Restart

in a quick second or two you should see your LogCat return


What worked for me besides restarting eclipse is:

  • Remove custom filters

After removing all filters, logcat was filled with text again Hope this will be helpful to someone else


Close logcat and then reopen it from Window>Show View>Others


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 furikuretsu. How? Window -> Devices -> 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 File -> Restart, I manually closed down Eclipse, and then restarted the application again.)

I can now see logs in my logcat.

Hope this helps you too.


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

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


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.


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.


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


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.


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.

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to logging

How to redirect docker container logs to a single file? Console logging for react? Hide strange unwanted Xcode logs Where are logs located? Retrieve last 100 lines logs Spring Boot - How to log all requests and responses with exceptions in single place? How do I get logs from all pods of a Kubernetes replication controller? Where is the Docker daemon log? How to log SQL statements in Spring Boot? How to do logging in React Native?

Examples related to logcat

strange error in my Animation Drawable Android Studio - ADB Error - "...device unauthorized. Please check the confirmation dialog on your device." Couldn't load memtrack module Logcat Error sendUserActionEvent() is null Android studio logcat nothing to show Restore LogCat window within Android Studio error opening trace file: No such file or directory (2) Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one? How to filter Android logcat by application? Filter output in logcat by tagname