xposed findAndHookMethod ClassNotFound

阅读更多
拦截指定类出现该提示

分析该apk 反编译出来的dex有很多个,因此应该是由于拦截的时候,加载了主dex,子dex还未加载
可以通过先拦截 Application.class的attach方法,通过Context的getClassLoader()方法得到的loader去加载



XposedHelpers.findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                if(webView != null && webView == param.thisObject) {
                    return;
                }

                webView = param.thisObject;
                ClassLoader cl = ((Context)param.args[0]).getClassLoader();
                Class hookclass = null;
                try {
                    hookclass = cl.loadClass("com.tencent.mm.plugin.appbrand.page.z");
                } catch (Exception e) {
                    XposedBridge.log("寻找com.tencent.mm.plugin.appbrand.page.z报错");
                    return;
                }

                ClassNotFoundException
                XposedBridge.log("寻找com.tencent.mm.plugin.appbrand.page.z成功");
                XposedHelpers.findAndHookMethod(hookclass, "bS", String.class, String.class, new XC_MethodHook(){
                    //进行hook操作
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        XposedBridge.log("hook" + param.args[0] + "," + param.args[1]);
                    }
                });
            }
        });

你可能感兴趣的:(xposed)