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"/>
    
  3. 配置app/build.gradle文件
    在相应标签下添加
    repositories {
      jcenter();
    }
    dependencies {
        compileOnly ‘de.robv.android.xposed:api:82‘
        compileOnly ‘de.robv.android.xposed:api:82:sources‘
    }
    
    注:compileOnly已经替代provided
  4. 新建一个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);
      }
    }
    
    
  5. 配置assets/xposed_init文件
    app/src/main下新建assets文件夹,内创建xposed_init文件
    内填入hook类(每行一个)
    示例
    com.example.hooktest1.MyHook
    
  6. 生成APK
    Build -> Build Bundle(s)/APK(s) -> Build APK(s) 来生成apk
  7. 安装入模拟器
    Xposed勾选,重启模拟器
  8. 查看效果
    Xposed 模块开发一 环境搭建

Xposed 模块开发一 环境搭建

上一篇:Vue 监听鼠标左键 鼠标右键以及鼠标中键修饰符click.left&contextmenu&click.middle


下一篇:定时器