Android 字节码插件集合,base_plugin 封装好了增量编译等编写插件重复代码,这样后续开发只需要关注对字节码的操作
可以认为是ByteX的简单版本。
- 方法前后插桩hook hook-method
- 示例插件,无实际功能 sample-plugin
- 自动try catch异常监控 auto-trycatch
- Java 字符串混淆/替换插件 strmix-plugin
- Log日志自动删除插件 remove-log-plugin
可以直接参考 sample-plugin。
-
plugin 目录下创建新module
-
编辑新module 的 build.gradle 文件
apply from: "../plugin.gradle" gradlePlugin { plugins { version { // 在 app 模块需要通过 id 引用这个插件 id = 'demo-plugin' // 实现这个插件的类的路径 implementationClass = 'com.miqt.plugin.sample.SamplePlugin' } } }
创建自定义 Plugin 继承自 BasePlugin 并实现抽象接口
public class SamplePlugin extends BasePlugin<SampleExtension> { @Override public ConfigExtension initExtension() { return new ConfigExtension(); } @Override public byte[] transform(byte[] classBytes) { return classBytes; } @Override public byte[] transformJar(byte[] classBytes, String jarName) { return classBytes; } @Override public String getName() { return "transform_name"; } }
创建 resources 文件夹和属性文件注册这个插件
在项目根目录的build.gradle引用插件,也可以发布后直接maven引用。
plugins { // 这个 id 就是在 ./plugin/demo-plugin 文件夹下 build.gradle 文件内定义的id id "demo-plugin" apply false }
在App module 中使用插件
apply plugin: 'com.miqt.plugin.sample'
完成
小知识点:
断点调试插件方法:https://miqt.github.io/2020/12/29/plugin-debug/
Android Studio 字节码查看插件:ASM Bytecode Viewer
android-plugin's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.