Android studio搭建xposed环境

一、环境准备

xposed:https://repo.xposed.info/module/de.robv.android.xposed.installer

xposed-api:https://forum.xda-developers.com/xposed/xposed-api-changelog-developer-news-t2714067

二、环境搭建

Android studio选择->Empty Actvity

Android studio搭建xposed环境

 

将api.jar包拖入至hook->app->libs,在jar文件上右键选择"As a Library"

 

Android studio搭建xposed环境

 

修改hook->app->src->main目录AndroidManifest.xml文件添加内容:

        <meta-data
            android:name="xposedmodule"  //表示作为Xposed的一个模块
            android:value="true"/>
        <meta-data
            android:name="xposeddescription"
            android:value="xposed demo"/> //模块的描述
        <meta-data
            android:name="xposedminversion" //最低要求的版本信息
            android:value="53"/>

Android studio搭建xposed环境

 

修改app->build.gradle文件将此处修改为compileOnly 默认(implementation)

Android studio搭建xposed环境

在此处选择assets Folder并创建file 文件xposed_int 填写入口类的完整类名例如:com.example.hook.hook

 Android studio搭建xposed环境

 

 

在app\src\main\java\com\example\hook\下创建java class文件与上面填写的xposed_init类名保持一直,编码hook代码

Android studio搭建xposed环境

package com.example.hook;
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;

public class hook implements IXposedHookLoadPackage {
    public void handleLoadPackage(final LoadPackageParam loadPackageParam) throws Throwable {

        Log.d("tag", "Hooking......");
        if(!loadPackageParam.packageName.equals("com.app")) return;
        Log.d("test","hook.....");
    }
}

点击Run即可在模拟器中xposed看到模块

 

 

Android studio搭建xposed环境

上一篇:移动端底部导航固定配合vue-router实现组件切换


下一篇:四句命令用mac电脑控制Android手机的屏幕