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

插件中的Activity嵌套Fragment崩溃 #292

Open
mooncong opened this issue Aug 10, 2017 · 6 comments
Open

插件中的Activity嵌套Fragment崩溃 #292

mooncong opened this issue Aug 10, 2017 · 6 comments

Comments

@mooncong
Copy link

当插件中的Activity使用Fragment的时候崩溃找不到相应的Fragment

Unable to instantiate fragment com.xx.TestFragment: make sure class name exists, is public, and has an empty constructor that is public

RePlugin version:2.1.7

Android compile SDK version:2.1.7

Android ROM:原生6.0.1

@jiongxuan
Copy link
Contributor

请先看下是不是满足崩溃中所说的三种情况,类名存在(且未被混淆)、声明为Public的,而且得有一个Public的构造函数。

此外,还可以参考下Sample中的Fragment的用法

@mooncong
Copy link
Author

以上条件都不满足,并且插件独立运行不崩溃,Sample使用方法是宿主Activity加载插件Fragment,而我的需求是插件中的Activity直接使用插件中的Fragment

@kevinfen9
Copy link
Contributor

这个应该是因为插件中不能解析xml中<fragment这个tag导致的,在框架没有解决之前可以先试试new fragment然后add进去

@jiongxuan
Copy link
Contributor

@kevinfen9 嗯,这个提议很好,看来你们助手应该也已经遇到了。
@mooncong 供参考,先看看是不是这个。

@SkyEric
Copy link
Contributor

SkyEric commented Feb 13, 2018

@orange7
Copy link

orange7 commented Feb 24, 2018

我通过动态方式添加fragment,使用add的方式动态添加,宿主是FragmentActivity动态添加的插件中的fragment,启动起来没有问题,但是在fragment跳转到新的插件以后,点击返回,程序就崩溃了,也是上面一样的错误make sure class name exists, is public, and has an empty constructor that is public,感觉好奇怪

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

5 participants