二、retrace.bat 命令执行目录
必须在 D:\001_Programs\001_Android\002_Sdk\Sdk\tools\proguard\lib 目录中执行 retrace.bat 命令 , 如果在别的目录会报下面的错误 ;
Error: Unable to access jarfile ..\lib\retrace.jar
三、暴露更少信息
使用以下配置 , 可以暴露更少信息 ;
-renamesourcefileattribute H
完整配置如下 :
# 保留行数 -keepattributes SourceFile,LineNumberTable -renamesourcefileattribute H
报错信息如下 :
2020-11-10 12:15:41.634 29988-29988/? E/AndroidRuntime: FATAL EXCEPTION: main Process: kim.hsl.handler, PID: 29988 java.lang.RuntimeException: Unable to start activity ComponentInfo{kim.hsl.handler/kim.hsl.handler.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'b.a.a.d b.a.a.b.a' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3897) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4076) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8349) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) Caused by: java.lang.NullPointerException: Attempt to read from field 'b.a.a.d b.a.a.b.a' on a null object reference at b.a.a.a.<init>(H:30) at kim.hsl.handler.MainActivity.onCreate(H:24) at android.app.Activity.performCreate(Activity.java:8085) at android.app.Activity.performCreate(Activity.java:8073) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3870) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4076) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8349) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
使用 -renamesourcefileattribute H 配置 前后对比对比 :
之前报错时 , 会将 Handler 暴露出来 ;
Caused by: java.lang.NullPointerException: Attempt to read from field 'b.a.a.d b.a.a.b.a' on a null object reference at b.a.a.a.<init>(Handler.java:30) at kim.hsl.handler.MainActivity.onCreate(MainActivity.kt:24)
使用 -renamesourcefileattribute H 配置后 , 报错信息如下 :
Caused by: java.lang.NullPointerException: Attempt to read from field 'b.a.a.d b.a.a.b.a' on a null object reference at b.a.a.a.<init>(H:30) at kim.hsl.handler.MainActivity.onCreate(H:24)