5

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?

aleph_null
  • 5,766
  • 2
  • 24
  • 39

3 Answers3

5

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
Hải Phong
  • 5,094
  • 6
  • 31
  • 49
1

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.

Avi
  • 2,373
  • 17
  • 22
  • 1
    Thanks for your reply. Regarding 1., looking into it a little more, proguard generates the mapping.txt file, but `@a:t:-1`, for instance, does not give you enough information to find the correct mapping since it lacks the package name of `a`. There will be multiple classes named `a`. This is why changing the exception format is important. As for 2., the crash reports I'm referring to are generated by google analytics, so it's part of a release build in the play store. And I agree with 3. – aleph_null May 17 '14 at 22:47
  • Hi, could u please explain why google mentions this `personally identifiable information should not be sent to Google` ?? Since the GA would only be viewable by the owner of the app, then what information is this really referring to? – Rat-a-tat-a-tat Ratatouille May 28 '14 at 08:29
1

The solution is to override StandardExceptionParser to also report the package name of the root cause. See my blog post for a way more detailed description.

aleph_null
  • 5,766
  • 2
  • 24
  • 39