-7

Ok, I think this is a bug. I'm new to Android, downloaded Android Studio 1.4 and tried to follow the tutorial (which is out of date and impossible to follow: ( https://code.google.com/p/android/issues/detail?id=188634&q=label%3AReportedBy-Developer&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars ). Never mind that, the first time I followed the tutorial when I connected my device it accurately displayed on the logcat all the info needed for the app and nothing else when run on my device. Next time when I restarted the Studio and plugged in my device it began to log everything my device did,regardless if I was running an app or not. So I uninstalled and deleted everything, tried it again and it was showing me just the interface inputs of my app, then I turned off my computer, next day restarted it, launched Android Studio, plugged my phone, and there it was again, logging everything.

This is very annoying because specific app logging get lost in all that logging, but specially because it clogs the memory and it didn't happened in the first run. Is there any way to fix/prevent it instead of re-installing?

I've googled this and read that the solution is to create specific app filter on logcat; but if logcat wasn't logging this at the first run (and it shouldn't), creating a filter seems to me like a bad solution. The thing is eating up memory, reading all kind of stuff about your phone (and you, privacy), and the filters just hiding these stuff out. Besides, again, if it wasn't doing that the first time, why cope with it afterwards.

gaboalonso
  • 37
  • 5

1 Answers1

5

First of all android studio itself creates the required filtering for logcat based on "debuggable" applications. So if you are indeed in possession of a debug-apk then when this application runs, android studio creates a filter for this particular application which you can choose from the filter in the top right corner of the debug/console window. There are by default 3 options there while running a debug application.

1 show only selected application

2 No filters

3 edit filter configurations

You can add custom filters by clicking on edit filter configurations. On the Top left side of the console/debug window you can see 2 drop downs, one for you to choose which application to show logs for (when show only selected application option is selected ofc), the other to choose the device. If there are no debuggable applications the drop down says no debuggable application, at that time the logcat will be shown for all apps.

Android by default will be logging from all applications, that's the reason why you have different levels of logging so that the level of logging required for building and debugging an application is not compiled into the release version of the application.

You can get more info on logging levels here. For example the Log.d doesn't get compiled and packaged to release apk but Log.e does. So be sure to use the proper levels of logging in your application and create proper filters for looking through the logcat

Bhargav
  • 8,118
  • 6
  • 40
  • 63
  • Thank you Bhargav. I guess the confusion was that when I first create the project it put the focus for it on logcat. So it didn't matter if I ran or debugged the app, it would show it on logcat and nothing else. After restarting the Studio there was no focus for the app on logcat nor an option to select it and I had to explicity hit the debug button so logcat could see it, but I was hitting the run button. Once I did that logcat saw it and it didn't mattered if I debugged it or ran it in future sessions, it would detect it. Thanks for helping me understand this. – gaboalonso Oct 27 '15 at 04:41
  • Sorry I don't have enough reputation points to up vote your answer, Bhargav. – gaboalonso Oct 27 '15 at 04:44