Search code examples
androidruntime-errorlogcatfatal-errorandroid-logcat

Android logcat: getting no fatal exceptions


I am actually developing an android application (min api:15, target api: 23). My problem is, that fatal exceptions are not shown in the logcat of the android studio. I have:

  • selected the right device on logcat
  • verbose mode on, no filter activated

I've tested the following code

Object o = null;
Log.i(TAG, o.getClass().toString());

on two devices:

  • Sony Xperia Tipo, Android version 4.03
  • Huawei P8 Lite, Android version 6.00
  • Emulator, Android version 6.00

And here comes the unthinkable: on the sony device, I can see fatal errors in the logcat, on the huawei device NOT. -> I don't know why. The thing is, I need the fatal errors for debugging...

Have someone have a hint for me? Greetings!


Solution

  • I believe it is something with the way you are writing your log. I am not sure what you have set TAG to but I would also try writing...

    Log.i("Fatal", o.getClass().toString());
    

    Then search your logcat for "Fatal" and it should bring you to your tag.

    The only other thing I would say it could be is the device itself. I am able to see fatal errors on both a virtual 6.0 and on a physical device which is a Samsung. I would try to do a factory reset on the device. Just make sure you have anything saved that you need as it will wipe everything.