Xposed 模块开发一 环境搭建

参考官方文档Development tutorial · rovo89/XposedBridge Wiki (github.com)

环境准备

雷电模拟器已经装好Xposed框架

编写模块

  1. 新建一个空白Android项目
  2. 配置AndroidManifest.xml
    <application>标签下配置
        <meta-data
          android:name="xposedmodule"
          android:value="true"/>
      <meta-data
          android:name="xposeddescription"
          android:value="xposeddescription"/>
      <meta-data
          android:name="xposedminversion"
          android:value="53"/>
  1. 配置app/build.gradle文件
    在相应标签下添加
repositories {
  jcenter();
}
dependencies {
    provided 'de.robv.android.xposed:api:82'
    provided 'de.robv.android.xposed:api:82:sources'
}
  1. 新建一个hook类
package com.example.hooktest1;


import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class MyHook implements IXposedHookLoadPackage {
    @Override
    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
        XposedBridge.log("Loaded MMMyapp: " + loadPackageParam.packageName);
    }
}

  1. 配置assets/xposed_init文件
    app/src/main下新建assets文件夹,内创建xposed_init文件
    内填入hook类(每行一个)
    示例
com.example.hooktest1.MyHook
  1. 生成APK
    Build -> Build Bundle(s)/APK(s) -> Build APK(s) 来生成apk
  2. 安装入模拟器
    Xposed勾选,重启模拟器
  3. 查看效果
    Xposed 模块开发一 环境搭建
上一篇:花了19998买的学习教程!安卓Apk安装过程,薪资翻倍


下一篇:安卓安全之应用加壳