Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch.jar无法加载 #48

Closed
djx1986sky opened this issue Mar 28, 2017 · 10 comments
Closed

patch.jar无法加载 #48

djx1986sky opened this issue Mar 28, 2017 · 10 comments

Comments

@djx1986sky
Copy link

/**

  • Created by mivanzhang on 17/2/27.
    */

public class PatchManipulateImp extends PatchManipulate {
@OverRide
protected List fetchPatchList(Context context) {
//将app自己的robustApkHash上报给服务端,服务端根据robustApkHash来区分每一次apk build来给app下发补丁
//String robustApkHash = RobustApkHashUtils.readRobustApkHash(context);
Patch patch = new Patch();
patch.setName("123");
patch.setLocalPath(Environment.getExternalStorageDirectory().getPath()+ File.separator+"robust"+File.separator + "patch.dex");
patch.setTempPath(Environment.getExternalStorageDirectory().getPath()+ File.separator+"robust"+File.separator + "patch");
patch.setPatchesInfoImplClassFullName("com.meituan.robust.patch.PatchesInfoImpl");
List patches = new ArrayList();
patches.add(patch);
return patches;
}
上述中的patch.setPatchesInfoImplClassFullName中设置的是一个继承patcesInfo的类吗?我在sample和你们的文章中都没有看到此类(继承的话应该如何处理?),现在加载patch.jar时老是报exceptionNotifyDidn't find class "com.meituan.robust.patch.PatchesInfoImpl" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib]] whereclass:PatchExecutor method:patch line:108

求解呀!

@oubowu
Copy link

oubowu commented Mar 28, 2017

这个是robust生成补丁时候的类,我反编译那个jar包,看到有这个类,包名也正确,就是跟你一样报找不到这个类的bug

@oubowu
Copy link

oubowu commented Mar 28, 2017

终于知道问题所在了,因为我自己写的demo没有声明读取sd卡的权限。。。。。。 @djx1986sky

@djx1986sky
Copy link
Author

我的demo有读取SD卡的权限的。。。但是还是报这个错误。。。@oubowu

@oubowu
Copy link

oubowu commented Mar 29, 2017

那你有改过robust.xml吗?就是生成补丁包名那个选项

@djx1986sky
Copy link
Author

改过,如下

<switch>
    <!--true代表打开Robust,这个会比较耗时建议release包在打开-->
    <turnOnRobust>true</turnOnRobust>
    <!--<turnOnRobust>false</turnOnRobust>-->

    <!--是否开启手动模式,手动模式会去寻找配置项patchPackname包名下的所有类,自动的处理混淆,然后把patchPackname包名下的所有类制作成补丁-->
    <!--<manual>true</manual>-->
    <manual>false</manual>

    <!--是否强制插入插入代码,Robust默认在debug模式下是关闭的,开启这个选项为true会在debug下插入代码-->
    <!--<forceInsert>true</forceInsert>-->
    <forceInsert>false</forceInsert>

    <!--是否捕获补丁中所有反射的异常,建议上线的时候这个开关的值为true,测试的时候为false-->
    <catchReflectException>true</catchReflectException>
    <!--<catchReflectException>false</catchReflectException>-->

    <!--是否在补丁加上log,建议上线的时候这个开关的值为false,测试的时候为true-->
    <!--<patchLog>true</patchLog>-->
    <patchLog>false</patchLog>
</switch>

<!--需要热补的包名或者类名,这些包名下的所有类都被会插入代码-->
<packname name="hotfixPackage">
    <name>com.demon.app</name>

</packname>

<!--不需要热补的包名或者类名,可以在需要热补的包中剔除指定的类或者包-->
<exceptPackname name="exceptPackage">
<!-- <name>com.test.cn.robustapplication</name>-->
<patchPackname name="patchPackname">
    <name>com.demon.patch</name>
</patchPackname>

<!--自动化补丁中,不需要反射处理的类,这个配置项慎重选择-->
<noNeedReflectClass name="classes no need to reflect">

</noNeedReflectClass>

@oubowu
Copy link

oubowu commented Mar 29, 2017

所以你的补丁包信息类名应该是com.demon.patch.PatchesInfoImpl,你可以反编译看看那个dex文件或者jar包

@djx1986sky
Copy link
Author

好的,谢谢,我试试看!

@mivanzhang
Copy link
Member

@djx1986sky @oubowu oubowu 正解

@awxy
Copy link

awxy commented Jun 20, 2019

@djx1986sky @oubowu oubowu 正解
老哥江湖救急 @add class patch.jar没有

@awxy
Copy link

awxy commented Jun 20, 2019

@djx1986sky @oubowu oubowu 正解

新增方法可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants