Android 常用第三方库介绍(持续更新中)

如题所述

第1个回答  2022-07-05

github地址 : https://github.com/square/leakcanary/

学习地址 : https://square.github.io/leakcanary/changelog/#version-22-2020-02-05

使用和原理分析
https://zhuanlan.zhihu.com/p/360944586
https://www.jb51.net/article/208385.htm#_lab2_2_2

关注点

1.LeakCananry自动检测步骤:

2.不用主动初始化,因为注册了contentProvider 在onCreate()时做了自动初始化的逻辑。

3.主动监测的实现

4.使用弱引用 来监听需要监听的对象,调动 Runtime.getRuntime.gc() 和 System.runFinalization() 来触发垃圾回收。然后再循环判断保存在队列中弱引用是否为空。为空,则从map中移除掉。最后根据map中剩下的元素数量来决定是否生成hprof文件,调用Debug.dumpHprofData()方法可以生成该文件。最后就是对hprof文件的。

System.runFinalization(); //强制调用已经失去引用的对象的finalize方法

5.有兴趣的话,可以自行了解hprof文件的分析处理过程。

github地址 : https://github.com/markzhai/AndroidPerformanceMonitor

学习地址 : http://blog.zhaiyifan.cn/2016/01/16/BlockCanaryTransparentPerformanceMonitor/

使用和原理分析
http://blog.zhaiyifan.cn/2016/01/16/BlockCanaryTransparentPerformanceMonitor/
https://www.jianshu.com/p/d172aafc3437

关注点:
1.Looper 的loop()方法内在循环从MessageQueue中获取的消息来处理的前后预留了接口,如下图所示,只要通过Looper.getMainLooper().setMessageLogging()来设置自定义的Printer,即可收到回调,用户就可以在回调中做一些cpu 、耗时等信息的收集。

github地址 : https://github.com/bumptech/glide

学习地址 : https://muyangmin.github.io/glide-docs-cn/

与其他图片加载库的对比
https://www.jianshu.com/p/97994c9693f9
https://blog.csdn.net/github_33304260/article/details/70213300

Glide源码分析
https://cloud.tencent.com/developer/article/1485133

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网