AbstractMethodError: abstract method "void android.telephony.TelephonyManager$CellInfoCallback.on...

一、Error现象:

应用开启混淆后,APP在Android 10及以上机型上的部分页面会闪退。

二、Error日志摘要:

java.lang.AbstractMethodError: abstract method "void android.telephony.TelephonyManager$CellInfoCallback.onCellInfo(java.util.List)"

三、Error详细日志:

2020-01-07 17:09:44.332 12910-14330/? E/AndroidRuntime: FATAL EXCEPTION: pama#1
    Process: com.xxx.xxxxxx, PID: 12910
    java.lang.AbstractMethodError: abstract method "void android.telephony.TelephonyManager$CellInfoCallback.onCellInfo(java.util.List)"
        at android.telephony.TelephonyManager$CellInfoCallback.onError(TelephonyManager.java:5391)
        at android.telephony.TelephonyManager$1.lambda$onError$2(TelephonyManager.java:5425)
        at android.telephony.-$$Lambda$TelephonyManager$1$DUDjwoHWG36BPTvbfvZqnIO3Y88.run(Unknown Source:6)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)
2020-01-07 17:09:44.561 2143-7549/? E/NcDft_GnssDftManager: network type error : passive
2020-01-07 17:09:44.569 12910-14332/? E/AndroidRuntime: FATAL EXCEPTION: pama#2
    Process: com.xxx.xxxxxx, PID: 12910
    java.lang.AbstractMethodError: abstract method "void android.telephony.TelephonyManager$CellInfoCallback.onCellInfo(java.util.List)"
        at android.telephony.TelephonyManager$CellInfoCallback.onError(TelephonyManager.java:5391)
        at android.telephony.TelephonyManager$1.lambda$onError$2(TelephonyManager.java:5425)
        at android.telephony.-$$Lambda$TelephonyManager$1$DUDjwoHWG36BPTvbfvZqnIO3Y88.run(Unknown Source:6)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)

四、原因:

高德地图定位库的使用,我们Gradle集成时设置为自动集成最新版,但是目前的最新版适配了Android 10,需要额外添加混淆保护(在原有混淆保护的内容上添加,具体可以查看官方文档):

-keep class com.loc.**{*;}
-keep class com.amap.api.services.**{*;}

五、反思:

由于闪退日志不够明确,定位较困难,发版前突发的这个问题导致团队通宵都没有排查到原因。而后禁用混淆勉强先发版上线。最后根据log日志,定位到必现的闪退页面,然后再一个个验证相关联的三方库才找到根本原因。这也是Gradle自动集成最新库的一个弊端,建议在没有和三方库合作方的售后保持联系的情况下,慎用自动集成最新版框架。

你可能感兴趣的:(【Android应用层】)