xposed hook入门(一)
1.架包的下载
https://files.cnblogs.com/files/pythonywy/xposed_架包.rar
https://files.cnblogs.com/files/pythonywy/xposed_jabao_2.rar
2.在android studio 构建架包
2.1.创建安卓工程
2.2.新增lib目录
2.3.api-82.jar拖入后构建路径(实际上就是使用第三方jar包)
2.4修改app→build.gradle中的(implementation files('libs/api-82.jar')) 改为(compileOnly files('libs/api-82.jar'))
3.写hook类
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class Demo implements IXposedHookLoadPackage {
//实现函数重写
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
Log.d("YWY","加载成功");
}
}
4.修改xml
默认的
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app_debug.demo2">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" />
</application>
</manifest>
修改后的
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app_debug.demo2">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="随便取名方便你后调用"/>
<meta-data
android:name="xposedminversion"
android:value="30" />
</application>
</manifest>