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

ClassCastException(cannot be cast to ShadowActivity) reproduced in Shadow source sample #285

Closed
buaasparkle opened this issue Mar 27, 2020 · 4 comments

Comments

@buaasparkle
Copy link

我在 PR #284 的 comment 中描述了重现场景和对应的代码修改,希望有空时可以帮助解答,谢谢~

@shifujun
Copy link
Collaborator

插件不能继承宿主中的Activity。你可以把BaseActivity中那些需要复用的逻辑抽到一个普通类里。

@buaasparkle
Copy link
Author

好的,谢谢,fragment 也应该是一样吗?

@shifujun
Copy link
Collaborator

fragment 也应该是一样吗?

是的。凡是插件里父类被修改了的,都一样。

@buaasparkle
Copy link
Author

fragment 也应该是一样吗?

是的。凡是插件里父类被修改了的,都一样。

好的 感谢~

@shifujun shifujun closed this as completed Apr 2, 2020
shifujun added a commit to shifujun/Shadow that referenced this issue Apr 19, 2020
对Fragment中涉及Activity类型的方法进行字节码编辑,在调入调出前后相互转换ContainerActivity和PluginActivity。

现在Fragment不会被改名,所以能正常Debug了。

测试用例考虑了如下情况:
1.Fragment是系统Fragment的直接子类、间接子类;
2.Fragment父类是DialogFragment(父类是系统类);
3.Fragment以代码方式添加和Xml方式添加;
4.Fragment作为其他Fragment的父类;
5.Fragment的父类只Override了Context版本或Activity版本的方法,或者同时Override了。
6.测试了API28和API19两款模拟器;

fix Tencent#168

related issues: Tencent#307, Tencent#285, Tencent#242, Tencent#243, Tencent#165, Tencent#151, Tencent#115, Tencent#24
shifujun added a commit to shifujun/Shadow that referenced this issue Apr 19, 2020
对Fragment中涉及Activity类型的方法进行字节码编辑,在调入调出前后相互转换ContainerActivity和PluginActivity。

现在Fragment不会被改名,所以能正常Debug了。

测试用例考虑了如下情况:
1.Fragment是系统Fragment的直接子类、间接子类;
2.Fragment父类是DialogFragment(父类是系统类);
3.Fragment以代码方式添加和Xml方式添加;
4.Fragment作为其他Fragment的父类;
5.Fragment的父类只Override了Context版本或Activity版本的方法,或者同时Override了。
6.测试了API28和API19两款模拟器;

fix Tencent#168

related issues: Tencent#307, Tencent#285, Tencent#242, Tencent#243, Tencent#165, Tencent#151, Tencent#115, Tencent#24
shifujun added a commit that referenced this issue Apr 19, 2020
对Fragment中涉及Activity类型的方法进行字节码编辑,在调入调出前后相互转换ContainerActivity和PluginActivity。

现在Fragment不会被改名,所以能正常Debug了。

测试用例考虑了如下情况:
1.Fragment是系统Fragment的直接子类、间接子类;
2.Fragment父类是DialogFragment(父类是系统类);
3.Fragment以代码方式添加和Xml方式添加;
4.Fragment作为其他Fragment的父类;
5.Fragment的父类只Override了Context版本或Activity版本的方法,或者同时Override了。
6.测试了API28和API19两款模拟器;

fix #168

related issues: #307, #285, #242, #243, #165, #151, #115, #24
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

2 participants