使用Xposed Hook多DEX的应用时,Xposed会抛ClassNotFound的异常,原因是它只会在classes.dex查找类。以下官方不完美解决办法,参考 Github上的 #30 issue.
public class RedClock implements IXposedHookLoadPackage { public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { final LoadPackageParam llpm = lpparam; if (!lpparam.packageName.equals("com.xxx.xxx.xxx")) return; findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { findAndHookMethod("com.xxx.xxx.log.Logger", llpm.classLoader, "easylog", String.class, String.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { //取easylog的2个参数 String log_tag = (String) param.args[0]; String log_content = (String) param.args[1]; } }); //findAndHookMethod } }); //findAndHookMethod } }