I'm trying to figure out how to keep original line numbers with R8.
Doing an app with current AndroidStudio and obfuscating it with R8, and even uploading mapping.txt
file to Google Play Console, the Stack Traces of the users are useless in some cases, because the lines of the crash are not the same as in the real non obfuscated file.
This is a sample, my class doesn't have 3000 lines, but the error is reported in line 3052 ( com.mypackage.activities.ManagerActivity.onCreate (ManagerActivity.java:3052)
):
Caused by: java.lang.NullPointerException:
at com.mypackage.activities.ManagerActivity.onCreate (ManagerActivity.java:3052)
at android.app.Activity.performCreate (Activity.java:7136)
at android.app.Activity.performCreate (Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2990)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3148)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1861)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:6819)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:497)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:912)
Is there a way to get the real line number of the error with R8 and AndroidStudio? Remember that this code is already deobfuscated with mapping.txt file
mapping.txt
file is uploaded together with the APK, then the Google Play Console should run the deobfuscation automatically. Apparently that does not work in this case. If it is possible to get the original stacktrace from the user in the Google Play Console, then it is possible to run the deobfuscation locally instead, to try to figure what is wrong. For reference what version of Android Studio/AGP/R8 are you using? – Wadaithrow new NullPointerException()
). If you can share the mapping file and maybe some stack traces with [email protected] and [email protected] we can try to help figuring out where this goes wrong. – Wadai-keepattributes LineNumberTable,SourceFile
. I'm wondering if I have an issue elsewhere that's overriding this? and help much appreciated @sgjesse? – Unionist