Reputation: 1542
It seems that a couple years ago before I started 'Generate Signed Bundles' for upload of my App to Google Play Store, that stack traces on the Play Console would show valid line numbers for where the error occurred in my code. But since then, I get invalid line numbers as such:
Exception java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4035)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4201)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2438)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8663)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
Caused by java.lang.NumberFormatException:
at sun.misc.FloatingDecimal.readJavaFormatString (FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble (FloatingDecimal.java:110)
at java.lang.Double.parseDouble (Double.java:538)
at com.-mydom-.mobile.Submit.onCreate (Submit.java:2)
at android.app.Activity.performCreate (Activity.java:8290)
at android.app.Activity.performCreate (Activity.java:8270)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4009)
In the line above
at com.-mydom-.mobile.Submit.onCreate (Submit.java:2)
Submit.onCreate starts at line number 103 and goes to 265. So, 'Submit.java:2' doesn't help me in any way that I know how to use.
How do I get back valid line numbers to improve my stack traces and debugging ability?
I have looked through a number of posts in stackoverflow and at Android docs and find things such as 'deobfuscation', but admit to simply being overwhelmed - as usual - with all the options (I don't know which branch of which option to pursue) and implementation details.
App size is not a concern. It is a very small app, so if I need to increase the size of my app to improve the info captured and optimize my ability to quickly analyze and correct bugs from the stack trace in the Play Console, I will gladly do that.
Update: here is what I find in my build.gradle concerning proguard.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Upvotes: 0
Views: 1004
Reputation: 690
If you rou have R8 enabled you should uncomment this lines
# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile
Upvotes: 3