User104163
User104163

Reputation: 579

Proguard-obfuscated stack traces incorrect in Firebase Crashlytics, even after uploading mapping file

I have an Android app built with Android Studio using Gradle, and it uses Proguard for obfuscation. After uploading the .aab file to the Play Store, I noticed that the crashes reported in Firebase Crashlytics are incorrect. Here's an example of a stack trace:

Fatal Exception: java.lang.NullPointerException Attempt to read from field 'boolean d3.z0.D0' on a null object reference com.cbm.qmobile.ui.main.LinechartFragment.isOnViewCreatedCalled (LinechartFragment.java:23) com.cbm.qmobile.ui.main.ChildFragment.setNoDataText (ChildFragment.java:23) com.cbm.qmobile.ui.main.ChildFragment.lambda$onViewCreated$4 (ChildFragment.java:475)

The problem:

  1. Line mismatch: In the LinechartFragment, line 23 is an import statement, so this line number in the stack trace is clearly incorrect.
  2. Obfuscated symbols: 'boolean d3.z0.D0'? I understand this is due to obfuscation, but the stack trace is not being de-obfuscated properly, even after uploading the mapping file.

Here’s what I’ve done so far to try to resolve the issue:

  1. Added mappingFileUploadEnabled true to my app-level build.gradle file:

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            firebaseCrashlytics {
                mappingFileUploadEnabled true
            }
        }
    }
    

    This didn’t make any difference.

  2. Manually uploaded the mapping.txt file to the Play Console at: C:\Users\Makram\AndroidStudioProjects\QMobile\app\build\outputs\mapping\release\mapping.txt

    After doing this, it seems that the "Crashes and ANRs" section in the Play Console is now empty, which is puzzling.

Also I do know that I can simply add the follwing lines to the proguard-rules.pro file:

-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile

However, I want to avoid this because:

Upvotes: 0

Views: 34

Answers (0)

Related Questions