以下内容按照帖子https://www.52pojie.cn/thread-728459-1-1.html来做的
不知道缺少了哪个步骤,求各位不吝指点!
我得到的日志输出如下
配置文件中对XposedBridgeAPI-89.jar的引用如下,有可能跟帖子中的不太一样
[Java] 纯文本查看 复制代码 dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation files('lib/XposedBridgeAPI-89.jar')
}
我的包名是
[Java] 纯文本查看 复制代码 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mytest">
那么我对应的beforeHookedMethod类为
[Java] 纯文本查看 复制代码 package com.example.mytest;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
public class Main implements IXposedHookLoadPackage {
private static final String HOOK_APP_NAME = "com.example.mytest";
/**
* 包加载的时候回调
* [url=home.php?mod=space&uid=952169]@Param[/url] lpparam
* @throws Throwable
*/
@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
//性能优化,避免操作无关app
if (!lpparam.packageName.equals(HOOK_APP_NAME))
return;
XposedBridge.log("zengraoli");
}
} |