-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
使用maven源码实现多插件启动的问题 #706
Comments
@shifujun 帮帮我,现在项目进行不下去了。已经卡在这一周没有进展了。 |
你可能需要更加仔细阅读说明和代码。maven那个工程只是为了演示如何正常接入SDK的。调试Shadow最好还是用source工程。那里面已经有多插件的演示了。 看起来只是一个 作为一个开源项目,而不是付费服务,我们只能尽量通过代码分享所有信息。不过#245 中也有一些人贡献了图和文档,你可以尝试从它们理解SDK。 另外,你应该把你的代码push上来,而不是靠文字描述,这样别人没法测试它,也看不到实际的代码改动。 |
@shifujun |
我收到你的邮件啦,我会尽快回复的哦,谢谢
Only efforts can prove that I existed in this world ---jarlen
|
你的代码看起来离能正常工作非常远,建议你还是参考 08da57d 吧。 |
不是非常远,我这只差一步,就是将uuid.txt放到build里面重新打包后,就可完美运行。 |
我也是和你完全一样的操作方式和报错情况。这样不就有重复的runtime和loader了? |
@pangliang071 按照你这种方式实现多插件的话,最后怎么解决的? |
是不是SamplePluginManager只有一个的原因呢? |
只需要在 build.gradle 中增加 uuid = '1234567890' 即可 |
@pangliang071 我也有多插件多进程的需求,请问你正常接入了吗?有没有demo提供下 |
我用sample下maven作为我的开发源码,
一、将plugin-project复制了一份,作为另外一个插件,然后将里面的partKey 改为 'sample-plugin2'。将包名改为“com.tencent.shadow.sample.plugin2”。打包成zip后再重命名为"plugin2-debug.zip"
二、将manager-project 里面的 samplePluginManager.java中enter函数中复制了一个代码如下:
public void enter(final Context context, long fromId, Bundle bundle, final EnterCallback callback) {
if (fromId == Constant.FROM_ID_START_ACTIVITY) {
bundle.putString(Constant.KEY_PLUGIN_ZIP_PATH, "/data/local/tmp/plugin-debug.zip");
bundle.putString(Constant.KEY_PLUGIN_PART_KEY, "sample-plugin");
bundle.putString(Constant.KEY_ACTIVITY_CLASSNAME, "com.tencent.shadow.sample.plugin.MainActivity");
onStartActivity(context, bundle, callback);
}else if (fromId == Constant.FROM_ID_START_ACTIVITY2) {
bundle.putString(Constant.KEY_PLUGIN_ZIP_PATH, "/data/local/tmp/plugin2-debug.zip");
bundle.putString(Constant.KEY_PLUGIN_PART_KEY, "sample-plugin2");
bundle.putString(Constant.KEY_ACTIVITY_CLASSNAME, "com.tencent.shadow.sample.plugin2.MainActivity");
onStartActivity(context, bundle, callback);
}else if (fromId == Constant.FROM_ID_CALL_SERVICE) {
callPluginService(context);
} else {
throw new IllegalArgumentException("不认识的fromId==" + fromId);
}
}
三、将宿主增加了一个按钮2,用于启动插件2.代码如下
Button button2 = new Button(this);
button2.setText("启动插件2");
button2.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(final View v) {
v.setEnabled(false);//防止点击重入
PluginManager pluginManager = InitApplication.getPluginManager();
pluginManager.enter(SecondActivity.this, FROM_ID_START_ACTIVITY2, new Bundle(), new EnterCallback() {
@OverRide
public void onShowLoadingView(View view) {
SecondActivity.this.setContentView(view);//显示Manager传来的Loading页面
}
四、将plugin-debug.zip,plugin2-debug.zip,sample-manager-debug.apk上传到 data/local/tmp下面。
五、运行sample-host ,现象是点击启动插件1按钮,插件1能起来,再点启动插件2按钮,程序崩溃。
重新安装sample-host,先点击启动插件2按钮,插件2可以起来,再点启动插件1按钮,程序崩溃。
六、错误信息如下:java.lang.RuntimeException: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tencent.shadow.sample.host/com.tencent.shadow.sample.plugin2.MainActivity}; have you declared this activity in your AndroidManifest.xml?
at com.tencent.shadow.sample.manager.SamplePluginManager$1.run(SamplePluginManager.java:102)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tencent.shadow.sample.host/com.tencent.shadow.sample.plugin2.MainActivity}; have you declared this activity in your AndroidManifest.xml?
七、我想知道哪里出现了问题,宿主,manager,插件1,还是插件2,我这么做的过程有没有问题呢?
The text was updated successfully, but these errors were encountered: