Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio, logcat cleans after app closes

People also ask

How do I stop Logcat from clearing?

Prevent clearing the log when the app crashes By default when the app got crashed the logcat clear's in the android studio. To prevent this, click the right end chooser(Filter Configuration chooser) in the logcat tab then select Edit Filter Configuration option and enter current app name and package name.

Why is my Logcat not showing anything in Android?

Solution 1: Restarting your Android StudioIn your IDE Go to File > Invalidate Caches and Restart > Invalidate and Restart. This Solution will clear all the caches of Android studio IDE and restart it automatically, By the method, there are 80% change that Logcat will start work as before.

How do I freeze Logcat?

Simple solution: In Android monitor, on the right, change No Filters -> Show only selected application. THIS should be THE Answer!


I had the same issue, but looks more like a feature than a bug:

In AndroidStudio, the default setting for the Logcat window seems to be "Show only selected Application" (top right corner of the Logcat window)... which is looking at the log of the selected process (your current launch by default). So when your app crashes during testing, that process is gone, so the filter clears the log.

Instead, select "Edit Filter Configuration..." and set up a filter for your app, eg:

  • FilterName: MyApp
  • PackageName: com.example.myapp (<< replace with your app's package name)

...and then select that filter for future runs. This should keep the log there for you, even after the app crashes.


Switch "Show only selected application" to "No filters". This way, you can see logcat output from a process even when that process isn't running.

The downside is that your logcat will be filled with more spam from other processes.


In case of crash see the Run tab at the bottom of IDE.

You can see the crash reason in this part (even in logcat clean case).

Note: If the above trick not works try to produce a crash and immediately disconnect the mobile cable (if you use the real device for the test). you can see the error before it cleaned.

Update: If also above trick not works, try to attach and detach phone and hopefully problem solved.

Update2: If again not work, try to Invalidate catches and Restart then start debugging again.

Update3: As The last way, try to remove the app and install it again then start debugging (if you do not lose that condition you want to test)


My App was crashing and restarting. I also had some problems on reading the logcat to know what was happening. I then noticed that in the drop down menu, next to the Device dropdown it had something like "com.mypackage.myapp ('some number')" and when my app crashed there was another option that said "com.mypackage.myapp ('some number') [DEAD]". If you select the "Dead" option, it will show you the logcat of the previous instance.

Dead LogCat


In Android Studio 2+

  1. Click Run

  2. Click Edit Configurations

  3. In the Run/Debug Configurations window select the Miscellaneous tab

  4. Make sure the Clear log before launch checkbox is not checked


Might be very late to the party but I had the same problem and solved like this:

In logcat window, top right corner drop-down menu select Edit filter configuration, on the next menu, introduce Filter name and your Package name.

Done, for me it keeps logs visible after crashing.


I'm Working with Android Studio 4.0 enter image description here

  1. Go to Edit Configuration of your app.
  2. Go to Miscellaneous Tab
  3. Uncheck the field Clear log before launch.
  4. Press OK. It'll work..