Meituan-Dianping / Robust

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
Apache License 2.0
4.43k stars 809 forks source link

应用补丁的时候显示类转换异常? #416

Open EricZHD opened 4 years ago

EricZHD commented 4 years ago

异常类型:app运行时异常

手机型号:Huawei Mate20 Pro

手机系统版本:Android10

Robust版本:0.4.99

Gradle版本:4.6

Gradle插件版本: com.android.tools.build:gradle:3.2.0

系统 Windows

问题:

应用补丁的时候,类转换异常

1 这是补丁: package com.example.asus.myapplication.patch;

import com.meituan.robust.PatchedClassInfo; import com.meituan.robust.PatchesInfo; import java.util.ArrayList; import java.util.List;

public class PatchesInfoImpl implements PatchesInfo { public List getPatchedClassesInfo() { ArrayList localArrayList = new ArrayList(); localArrayList.add(new PatchedClassInfo("com.example.asus.myapplication.AES", "com.example.asus.myapplication.patch.AESPatchControl")); com.meituan.robust.utils.EnhancedRobustUtils.isThrowable = true; return localArrayList; } }

2 这是异常:

2020-07-09 17:06:58.441 1598-2074/com.example.asus.myapplication D/robust: patchManipulate list size is 1 2020-07-09 17:06:58.442 1598-2074/com.example.asus.myapplication W/System: ClassLoader referenced unknown path: null_temp.jar 2020-07-09 17:06:58.443 1598-2074/com.example.asus.myapplication D/robust: patch patch_info_name:com.example.asus.myapplication.patch.PatchesInfoImpl 2020-07-09 17:06:58.444 1598-2074/com.example.asus.myapplication E/robust: patch failed 188 java.lang.ClassCastException: com.example.asus.myapplication.patch.PatchesInfoImpl cannot be cast to com.meituan.robust.PatchesInfo

EricZHD commented 4 years ago

补充一下: 这是robust.xml

com.example.asus.myapplication
<patchPackname name="patchPackname">
    <name>com.example.asus.myapplication.patch</name>
</patchPackname>
EricZHD commented 4 years ago

非常费解。。补丁包我反编译看了一下,确实就是集成了 com.meituan.robust.PatchesInfo 这个接口,但是转换就是异常 com.example.asus.myapplication.patch public class PatchesInfoImpl implements PatchesInfo