{"repo":"Vinctor/Uatu","free":true,"listed":false,"github":"https://github.com/Vinctor/Uatu","clone":"git clone https://github.com/Vinctor/Uatu.git","description":"Android方法调用跟踪 ; 方法耗时统计 ; 方法调用参数以及返回值跟踪 ; 方法调用替换;方法hook","language":"Java","stars":103,"topics":["trace","hook","replace","asm","plugin","methodtrace","apm"],"license":null,"category":"analytics","readme_excerpt":"Uatu 用于项目中方法替换和方法的跟踪(查看参数, 返回值, 方法耗时等). 用法 一: root project build.gradle 中添加: 其中 二: app module build.gradle 中: 应用: 添加配置: 详细说明: 配置分为两部分: 方法跟踪和方法替换 方法跟踪 traceConfig traceClass 方法跟踪的输出类, 该类为使用者自行实现,需要声明两个静态方法 start 和 end , 被跟踪方法会调用这两个静态方法,如下: Demo效果: tracePackage 需要被跟踪的类或包列表, 需要写明类或包的全限定名, 匹配时是根据contain匹配的, 所以可以灵活组合,匹配到的类将跟踪该类中的所有方法, 调用时,将输出到上述 traceClass 中 ,如: exclude 在匹配到的多个类中, 要排出的类, 需要写明类或包的全限定名 方法替换 replaceConfig 在调用一个方法时, 可以在不修改代码的情况下, 将其替换成为其他的方法 如: 调用系统的静态方法 TextUtils.isEmpty() 方法, 可以通过配置将其替换为我们自己实现的 MyTextUtils.isEmpty() configFile 格式如下: 如: 我们要把 TextUtils.isEmpty() ,替换为 MyTextUtils.isEmpty() , 则配置如下: MyTextUtils.isEmpty() 实现如下: 则在编译过程中会根据配置替换完成, 从而打印出字符串: 需要注意的地方 如果原始方法为静态方法, 目标方法的参数和返回类型需与原始方法保持一致; 如果原始方法为非静态方法, 目标方法的第一个参数类型需为原始方法的调用类的类型, 后续参数需要与原始方法参数保持一致, License -------","default_branch":null,"files":null,"tree":[],"storefront":"/r/Vinctor","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Vinctor/Uatu/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}