Android平台主流开源框架的源码与原理分析(Okhttp/Glide/Gson等)

Android平台主流开源框架的源码与原理实现- https://github.com/sucese/android-open-framework-analysis
-- Fresco图片框架
三级缓存:内存缓存/磁盘缓存/网络获取图片。
  更好的去理解Fresco的实现,还是要从 整体入手,了解它的模块和层次划分,层层推进,逐个理解,才能达到融会贯通的效果。
  磁盘缓存因为涉及到文件读写要比内存缓存复杂一些,从下至上可以将磁盘缓存分为三层:
缓冲缓存层:由BufferedDiskCache实现,提供缓冲功能。
文件缓存层:由DiskStroageCache实现,提供实际的缓存功能。
文件存储层:由DefaultDiskStorage实现,提供磁盘文件读写的功能。

-- 检测内存泄漏框架
 集成LeakCanary1.6.3 Android
Leakcanary是square公司开源的一款内存监测框架,https://github.com/square/leakcanary
dependencies {
  debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
  // Optional, if you use support library fragments:
  debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
}

public class ExampleApplication extends Application {
  @Override 
  public void onCreate() {
    super.onCreate();
    if (!LeakCanary.isInAnalyzerProcess(this)) {
      // This process is dedicated to LeakCanary for heap analysis.
      // You should not init your app in this process.
      // return;
    LeakCanary.install(this);
    }
  }
}

猜你喜欢

转载自blog.csdn.net/ShareUs/article/details/91962569