Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Crashlytics sending incorrect line number

I'm trying to integrate Crashlytics with my app and it's working, however the line number passed through seems to be incorrect. This is a stack I'm getting for my test exception:

Fatal Exception: java.lang.RuntimeException: This is a test crash
   at com.myapp.testapp.activity.MainActivity.animateReveal(MainActivity.java:42453)
   at com.myapp.testapp.activity.MainActivity.onClick(MainActivity.java:1356)
   at android.view.View.performClick(View.java:5204)
   at android.view.View$PerformClick.run(View.java:21153)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5417)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

So my crash is on line number 1453 but for some reason it's showing up as 42453? Interestingly, the next line number in the stack is correct...

Proguard:

# Crashlitics

-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keepattributes *Annotation*
like image 825
vkislicins Avatar asked Jul 22 '16 14:07

vkislicins


People also ask

Is Crashlytics deprecated?

we are writing to let you know that the Fabric Crashlytics SDK is now deprecated and will continue reporting your app's crashes until November 15, 2020. After this date, the Fabric Crashlytics SDK and beta versions of the Firebase Crashlytics SDK will stop sending crash reports for your app.

How do I debug Crashlytics?

Enable debug logging for Crashlytics If you don't see your test crash in the Crashlytics dashboard, you can use debug logging for Crashlytics to help track down the problem. Enable debug logging: In Xcode, select Product > Scheme > Edit scheme. Select Run from the left menu, then select the Arguments tab.


1 Answers

To preserve the information that Firebase Crashlytics SDK requires for producing readable crash reports, add the following lines to your Proguard or Dexguard config file:

-keepattributes SourceFile,LineNumberTable        # Keep file names and line numbers.
-keep public class * extends java.lang.Exception  # Optional: Keep custom exceptions.
like image 57
Android Developer Avatar answered Oct 05 '22 23:10

Android Developer