xposed hook入门(一)

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>

5.编写编译apk路径并编译

1.右键mian文件Folder-->assets

2.在asset文件目录下创建xposed_init

3.在xposed_init下写hook类路径如(com.app_debug.demo2.Demo)

4.开始编译并安装

6.文献总结参考

https://www.bilibili.com/video/BV1KC4y1W7xh

posted @ 2021-03-15 14:42  小小咸鱼YwY  阅读(504)  评论(0编辑  收藏  举报