houkx / android-pluginmgr

apk plug apkplug apk load
1.58k stars 545 forks source link

出现ClassCastException 不知道怎么回事 #9

Closed fayou147 closed 9 years ago

fayou147 commented 9 years ago

03-12 10:59:50.200: E/AndroidRuntime(6374): Caused by: java.lang.ClassCastException: androidx.pluginmgr.PluginContextWrapper cannot be cast to android.app.Application

houkx commented 9 years ago

使用哪个分支的代码?experiment分支应该没有这个问题吧

fayou147 commented 9 years ago

dev上的

houkx commented 9 years ago

这个来自比较老的版本了 不是我维护的了

fayou147 commented 9 years ago

用了一下experiment分支 出现ANR了 dev上的有的apk还是能用的 experiment直接不能用 看了 一下好像是PluginPackageManager在getActivityIcon的时候int icon = actInfo.icon;的值=0;所以递归了 但是说递归的话又没有在循环输出log。实在是想不明白

fayou147 commented 9 years ago

static final String targetClassName = "androidx.pluginmgr.PluginActivity";没这个类啊!!PluginManager的 context.startActivity(new Intent().setComponent(new ComponentName( context, ActivityOverider.targetClassName)).putExtra(ActivityOverider.PLUGIN_ID, pkgOrId) .putExtra(ActivityOverider.PLUGIN_ACTIVITY, plug.getMainActivity().activityInfo.name));是到哪啊??

houkx commented 9 years ago

这样吧 你把dev里面PluginContextWrapper 的geApplicationContext()方法的 return this 改为 return plugin.getApplication()