Home » Android » Exception stack trace lost in Google Analytics v2 for Android?

Exception stack trace lost in Google Analytics v2 for Android?

Posted by: admin June 15, 2020 Leave a comment


The stack trace is crucial to fix problems. In Android you can find nice reports in the Play store console. Unless you use Google Analytics V2. In this case Analytics seems to swallow the exceptions. Worse, Analytics seems to log only the first line of the exception and thus loosing the stacktrace. At least it is not shown in the error report.

Here’s a snip from our analytics.xml:

<!-- Enable automatic exception tracking -->
<bool name="ga_reportUncaughtExceptions">true</bool>
<bool name="ga_debug">false</bool>

See also here: https://developers.google.com/analytics/devguides/collection/android/v2/exceptions#easytracker

So, could there be something missing/wrong in our app?

How to&Answers:

As previous answer (user857661) says, see the Google Analytics docs on creating a new ExceptionReporter, or see my blog post on how to assign a custom ExceptionParser into the default handler.


If you want to see complete exception trace on GA V3.0 onwards, send your exception like

String exceptionTrace = "Any custom string as well " + getExceptionDescription(Ex);    
EasyTracker.getInstance(context).send(MapBuilder.createException(exceptionTrace, false).build());


You can overwrite the ExceptionParser class to get more info about the stacktrace: https://developers.google.com/analytics/devguides/collection/android/v2/exceptions#exception-parser. I am not sure if the stacktrace will be very readable in the Google Analyctics web interface though.