It is already annoying that your app crashes. But even more so when you can’t find the crash in the logcat due to the app restarting on either the emulator or a physical device.
Luckily, there is a very simple and quick solution for this, it stops Android Studio from clearing the logcat which means you can stop trying to reproduce it multiple times or are forced to use the command line. You can just start fixing the actual error instead.
It only consists of two steps, first open the logcat window in your Android Studio if it’s not already there. On the top right you see the filters dropdown. Open this and select Edit Filter Configuration.
In the Create New Logcat Filter window fill in the Package Name of your application. In my case it is
eu.walkthecity. You can fill in anything you want in Filter Name but I would recommend to put the name of your application there so you can easily find it back if you’re working on multiple apps.
The Log Level can be set to anything you want as crashes are always reported as Error. I used Verbose so I can just leave this filter on when looking for my debug messages as well.
Voila, you’re done. Simple right? Now back to more important stuff and get those amazing apps out there!