Android(安卓)Hugo
16lz
2021-01-24
https://github.com/JakeWharton/hugo
JakeWharton 大神的日志框架,用于 debug build 时显示方法的参数、返回值、运行时间。
用法
将 @DebugLog
注解添加到方法前即可。
@DebugLogpublic String getName(String first, String last) { SystemClock.sleep(15); // Don't ever really do this! return first + " " + last;}
V/Example: ⇢ getName(first="Jake", last="Wharton")V/Example: ⇠ getName [16ms] = "Jake Wharton"
打印日志只会在 debug builds 发生,注解也不会在任何编译后的 class 文件出现。完全不影响非 debug builds.
配置
Example
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' }}apply plugin: 'com.android.application'apply plugin: 'com.jakewharton.hugo'
可以临时性禁用:
hugo { enabled false}
也支持在运行时切换, use Hugo.setEnabled(true|false)
问题
运行时 java.lang.VerifyError 未找到解决方案,也好久没发新版本了,回头再看看吧。
更多相关文章
- Android应用开发中如何进行单元测试
- Android(安卓)RecyclerView:设置指定位置的两种方法
- android线程相关1
- android View的三个构造方法 简单总结
- Android抓包方法
- okhttp源码学习分析一
- Android开发经验总结
- Android倒计时实现
- android dialog 背景透明的样式