Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Analytics v4 uncaught exceptions and proguard

I'm using the Google Analytics v4 API on an Android app that was built with proguard. The resulting crash reports are cryptic. For instance, `NullPointerException (@a:t:-1) {main}'

1) Can I find the exact location of this crash with the information provided without guessing?

2) How can I improve the readability of the crash reports? The documentation shows how to set a custom exception reporter and that makes sense. However, it also states

Never send the exception message (e.getMessage()) to Google Analytics as it may contain personally identifiable information.

So if not the message, what fields of the exception could I use to generate a crash report that lets me find the position of the crash on an app with proguard?

like image 359
aleph_null Avatar asked May 16 '14 04:05

aleph_null


2 Answers

In addition to @aleph_null has said, you should add these two lines into your proguard config file to keep your line number, otherwise you always see -1 in the exception message.

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
like image 196
Hải Phong Avatar answered Sep 27 '22 18:09

Hải Phong


A few things:

  1. Proguard generates a map of ranames that it did for every compilation that you do. If you have those files saved somewhere, you can map the stack yourself.
  2. If you are just debugging the application on local machine, try disabling proguard.
  3. I think the primary concern here is that personally identifiable information should not be sent to Google. If you can somehow just parse the top 2 or 3 classes of the stack trace, won't things work?

Feel free to ask more detailed questions and I'll try to help.

like image 33
Avi Avatar answered Sep 27 '22 17:09

Avi