Android Studio, logcat cleans after app closes

六眼飞鱼酱① 提交于 2019-11-27 17:13:52

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.

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.

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

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

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

i have faced the same issue and this is the solution :-

1- Tools --> Android --> Enable ADB Integration.

and now you can see the logcat and the crashes as normal

The filter clears the log once the app gets crashed. So select "Edit Filter Configuration" and create your own custom filter with filter name. This will save the log with informations even when the app is crahed.

It is 2018 and this can still happen. Close Android Studio and reopen.

This bug seems to be fixed with the new release of Android Studio version 1.2.2

I ran into the same problem and none of the answers could help me, until I realized my app was causing an OutOfMemoryException. That's a probable root cause as well.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!