简体   繁体   中英

How do I get Firebase to tell me the exact line of code a user crashed at?

在此处输入图片说明

Look at these crash reports for my android app. Most of them either give me something useless like it crashed at line 1 or 3, or it gives no line at all. Is this how Firebase is supposed to work?

If you are using Proguard try this workaround:

There will be a file named proguard-rules.pro in your Gradle Scripts section on Android Studio/ or in app folder of your project in your explorer.

In this file uncomment this line:

-keepattributes SourceFile,LineNumberTable

This will keep your ClassName and line Number OK.

If you want to hide your className uncomment this line too.

-renamesourcefileattribute SourceFile

And also write this line at last

-printmapping mapping.txt

This line will generate a mapping.txt file (which you can find in the app folder) to deobfuscate your stack trace when you publish the app in the playstore.

After doing all this, create a new release build of your app and update your existing build. Your crash report should work fine now.

If your app is available in the play store, with the apk you need to upload the generated mapping.txt file also. (If you are uploading aab file you don't need to upload it)

To upload the mapping file in the new play console follow these steps:

  • Go to Release/"App bundle explorer"
  • Select the right artifact in the top right corner
  • Open Downloads tab
  • Scroll to the Assests section
  • Next to the "ReTrace mapping file" there should be an upload Button

This should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM