All Projects → JieYuShi → Luffy

JieYuShi / Luffy

Android字节码插件,编译期间动态修改代码,改造添加全埋点日志采集功能模块,对常见控件进行监听处理

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Luffy

Jquery Match Height
a responsive equal heights plugin
Stars: ✭ 3,100 (+793.37%)
Mutual labels:  plugin
Mybatipse
Eclipse plugin adding support for MyBatis SQL Mapper Framework.
Stars: ✭ 312 (-10.09%)
Mutual labels:  plugin
Klakspout
Spout plugin for Unity
Stars: ✭ 332 (-4.32%)
Mutual labels:  plugin
Intellij Elm
Elm language support for IntelliJ, WebStorm, PhpStorm and PyCharm (JetBrains)
Stars: ✭ 305 (-12.1%)
Mutual labels:  plugin
Grafana Diagram
A Grafana plugin to visualize metrics in a diagram using flow charts, gantt charts, sequence diagrams, or class diagrams
Stars: ✭ 310 (-10.66%)
Mutual labels:  plugin
Vim Flog
A lightweight and powerful git branch viewer for vim.
Stars: ✭ 314 (-9.51%)
Mutual labels:  plugin
Validate
A simple jQuery plugin to validate forms.
Stars: ✭ 298 (-14.12%)
Mutual labels:  plugin
Zoomove
🔍 🎆 Enlarges the image with the mouse hover and move
Stars: ✭ 339 (-2.31%)
Mutual labels:  plugin
Chartjs Plugin Streaming
Chart.js plugin for live streaming data
Stars: ✭ 310 (-10.66%)
Mutual labels:  plugin
Xd To Flutter
Xd to Flutter
Stars: ✭ 326 (-6.05%)
Mutual labels:  plugin
Vimpyter
Edit your Jupyter notebooks in Vim/Neovim
Stars: ✭ 308 (-11.24%)
Mutual labels:  plugin
Firebasepushnotificationplugin
Firebase Push Notification Plugin for Xamarin iOS and Android
Stars: ✭ 307 (-11.53%)
Mutual labels:  plugin
Hexo Generator Search
A plugin to generate search data for Hexo.
Stars: ✭ 318 (-8.36%)
Mutual labels:  plugin
Speech recognition
A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)
Stars: ✭ 302 (-12.97%)
Mutual labels:  plugin
Huebee
🐝 1-click color picker
Stars: ✭ 332 (-4.32%)
Mutual labels:  plugin
Smartshape2d
A 2D Terrain Tool for Godot 3.2
Stars: ✭ 285 (-17.87%)
Mutual labels:  plugin
Custom Field Suite
Custom fields UI for WordPress
Stars: ✭ 312 (-10.09%)
Mutual labels:  plugin
Findcrypt Ghidra
IDA Pro's FindCrypt ported to Ghidra, with an updated and customizable signature database
Stars: ✭ 340 (-2.02%)
Mutual labels:  plugin
Spectralizer
Audio visualizer plugin for obs-studio
Stars: ✭ 332 (-4.32%)
Mutual labels:  plugin
Highlightjs Line Numbers.js
Line numbering plugin for Highlight.js
Stars: ✭ 323 (-6.92%)
Mutual labels:  plugin

Luffy

Android字节码插件,编译期间动态修改代码

1、更新日志

2018.12.07更新

参考神策的全埋点日志SDK,进行功能重构扩展完善,以方便正式应用到线上应用

1、针对日志采集的全埋点对各个常见十多种控件进行埋点监听及处理(AutoTrackHelper类)

  • onFragmentViewCreated
  • trackFragmentResume
  • trackFragmentSetUserVisibleHint
  • trackOnHiddenChanged
  • trackFragmentAppViewScreen
  • trackExpandableListViewOnGroupClick
  • trackExpandableListViewOnChildClick
  • trackListView
  • trackTabHost
  • trackTabLayoutSelected
  • trackMenuItem
  • trackRadioGroup
  • trackDialog
  • trackDrawerOpened
  • trackDrawerClosed
  • trackViewOnClick
  • trackViewOnClick

2、可以在build.gradle进行多个自定义插桩配置

3、针对埋点控件及自定义配置功能的logapp测试应用

2018.03.28更新

插件扩展,新增自动埋点实战功能 2018.03.28更新 插件扩展,新增自动埋点实战功能

  • View的onClick(View v)方法
  • Fragment的onResume()方法
  • Fragment的onPause()方法
  • Fragment的setUserVisibleHint(boolean b)方法
  • Fragment的onHiddenChanged(boolean b)方法
  • 在app的module中手动设置的监听条件:指定方法或注解方法

2、使用步骤

要是使用演示的话,因为还没上传到jcenter库,所以只能本地仓库打包插件,记得要先把依赖都注释掉,插件打包完成后再启用,不然会编译不过去的。

本地打包及使用步骤:

  • 2.1、AndroidStudio右侧Gradle->:plugin->upload->uploadArchives,打包成功会在项目目录snapshotRepo中
  • 2.2、根build.gradle添加插件
dependencies {
    classpath 'oms.mmc:autotrack-gradle-plugin:1.0.0-SNAPSHOT'
}
  • 3、app的build.gradle中进行配置
apply plugin: 'oms.mmc.autotrack'

xiaoqingwa {
    // 是否打印日志
    isDebug = true
    // 是否打开SDK的日志全埋点采集
    isOpenLogTrack = true
    // 支持自定义配置,可选
    matchData = [[
                         //方法的匹配,可以通过类名或者实现的接口名匹配
                         'ClassName'    : 'com.mmc.lamandys.liba_datapick.Counter2',
                         'InterfaceName': '',
                         'MethodName'   : 'test2',
                         'MethodDes'    : '(Landroid/view/View;)V',
                         'isAnnotation' : true,
                         //插入的字节码,方法的执行顺序visitAnnotation->onMethodEnter->onMethodExit
                         'MethodVisitor': {
                             MethodVisitor methodVisitor, int access, String name, String desc ->
                                 MethodVisitor adapter = new AutoMethodVisitor(methodVisitor, access, name, desc) {
                                     boolean isAnnotation = false

                                     @Override
                                     protected void onMethodExit(int opcode) {
                                         super.onMethodExit(opcode)
                                         //使用注解找对应方法的时候得加这个判断
                                         if (!isAnnotation) {
                                             return
                                         }
                                         // INVOKESTATIC
                                         methodVisitor.visitMethodInsn(184, "com/mmc/lamandys/liba_datapick/AutoHelper", "onClick2", "()V", false)
                                     }

                                     /**
                                      * 需要通过注解的方式加字节码才会重写这个方法来进行条件过滤
                                      */
                                     @Override
                                     AnnotationVisitor visitAnnotation(String des, boolean visible) {
                                         if (des == 'Lcom/xishuang/annotation/AutoCount;') {
                                             println "注解匹配:" + des
                                             isAnnotation = true
                                         }
                                         return super.visitAnnotation(des, visible)
                                     }
                                 }
                                 return adapter
                         }
                 ],
                 [
                         //方法的匹配,可以通过类名或者实现的接口名匹配
                         'ClassName'    : 'com.mmc.lamandys.liba_datapick.Counter',
                         'InterfaceName': '',
                         'MethodName'   : 'test',
                         'MethodDes'    : '()V',
                         'isAnnotation' : false,
                         //插入的字节码,方法的执行顺序visitAnnotation->onMethodEnter->onMethodExit
                         'MethodVisitor': {
                             MethodVisitor methodVisitor, int access, String name, String desc ->
                                 MethodVisitor adapter = new AutoMethodVisitor(methodVisitor, access, name, desc) {

                                     @Override
                                     protected void onMethodEnter() {
                                         super.onMethodEnter()
                                     }

                                     @Override
                                     protected void onMethodExit(int opcode) {
                                         super.onMethodExit(opcode)
                                         // INVOKESTATIC
                                         methodVisitor.visitMethodInsn(INVOKESTATIC, "com/mmc/lamandys/liba_datapick/AutoHelper", "onClick3", "()V", false)
                                     }
                                 }
                                 return adapter
                         }
                 ]
    ]
}
  • 2.4、Clean Project打包应用

在logapp->build->intermediates->transforms->AutoTrack->debug中可查看插桩后的类文件:插桩类文件

具体编译的字节码可查看编译日志:编译日志

具体采集后的日志及处理可看应用日志:应用日志 应用日志规范后效果

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].