Open makeloveandroid opened 3 years ago
问题 我看加载插件使用DeclassLoader
ClassLoader mcl = new DexClassLoader(moduleApkPath, moduleOdexDir, moduleLibPath, appClassLoader);
这里有个问题,如果插件和宿主中存在相同的类(都用了相同点库),这时候就会出现问题。 我看Xposed源码
ClassLoader mcl = new PathClassLoader(apk, XposedBridge.BOOTCLASSLOADER);
我尝试改成。
ClassLoader mcl = new DexClassLoader(moduleApkPath, moduleOdexDir, moduleLibPath, ClassLoader.getSystemClassLoader()); 或者 ClassLoader mcl = new DexClassLoader(moduleApkPath, moduleOdexDir, moduleLibPath, appClassLoader.getParent());
这样应该能解决这个问题,但是奇怪的是
Class<?> moduleClass = mcl.loadClass(moduleClassName);
既然 找不到这个类了?不应该啊 moduleClassName 不应该在插件里面吗?
moduleClassName
大佬知道啥原因吗?
我知道为啥了,因为 插件的 moduleClassName 中实现的 IXposedHookLoadPackage 没有打包在插件中。而是在宿主中。
所以必须要使用 appClassLoader
但是就有了 如果插件和宿主中存在相同的类(都用了相同点库),这时候就会出现问题了。
问题 我看加载插件使用DeclassLoader
这里有个问题,如果插件和宿主中存在相同的类(都用了相同点库),这时候就会出现问题。
我看Xposed源码
我尝试改成。
这样应该能解决这个问题,但是奇怪的是
既然 找不到这个类了?不应该啊
moduleClassName
不应该在插件里面吗?大佬知道啥原因吗?