网站首页 > 技术文章 正文
在 Android 开发的过程中,每个开发者或多或少的都使用过第三方开源库,使用第三方开源库可以大大减少开发者的精力和时间,从而更好的关注应用本身的业务逻辑。
网络相关
- OkHttp
一个处理网络请求的开源项目,是安卓端最火热的网络框架
implementation("com.squareup.okhttp3:okhttp:4.10.0")
- Retrofit
Retrofit 是一个适用于 Android 和 Java 的类型安全的 HTTP 客户端。值得注意的是:Retrofit 网络请求的本质工作是什么 OkHttp 完成的,而 Retrofit 只负责网络请求接口的封装。另外 Retrofit 运用了大量的设计模式(值得大家阅读源码学习),它们分别是:外观模式、构建者模式、工厂方法、策略模式、适配器模式、动态代理。
implementation 'com.squareup.retrofit2:retrofit:(insert latest version)'
图片相关
- Glide
Glide是一个快速高效的Android图片加载库,注重于平滑的滚动。Glide提供了易用的API,高性能、可扩展的图片解码管道(decode pipeline),以及自动的资源池技术。值得注意的是:此库会根据 ImageView 的大小来动态改变下载的图片的尺寸大小,之后才会进行缓存,也就是说如果下载同一张图片,但设定了两个不一样大小的 ImageView ,那么 Glide 实际上会缓存两份的(这里的下载逻辑与下面的 Picasso 有所区别)。
- Fresco
Fresco是非常强大的显示图像的开源库。
implementation 'com.facebook.fresco:fresco:2.6.0'
使用文档:https://www.fresco-cn.org/
- Picasso
一个强大的安卓图片下载和缓存库(两级缓存:内存、本地)。需要注意的是此库不支持 GIF 的支持。
implementation 'com.squareup.picasso:picasso:2.8'
数据库相关
- greenDao
greenDAO 是一种用于 Android 的轻量级 ORM,可将对象映射到 SQLite 数据库。 greenDAO 针对 Android 进行了高度优化,提供出色的性能并消耗最少的内存。
implementation 'org.greenrobot:greendao:3.3.0' // add library
- LitePal
LitePal是一款开源的Android数据库框架,它采用了对象关系映射(ORM)的模式,并将我们平时开发时最常用到的一些数据库功能进行了封装,使得不用编写一行SQL语句就可以完成各种建表、増删改查的操作。并且LitePal很“轻”,jar包只有100k不到,而且近乎零配置,这一点和Hibernate这类的框架有很大区别。
implementation 'org.litepal.guolindev:core:3.2.3'
- Sugar ORM
Sugar ORM 的构建与其他 ORM 相比具有:
- 一个简单、简洁、干净的集成过程,配置最少。
- 通过反射自动命名表和列。
- 支持不同模式版本之间的迁移。
implementation 'com.github.satyan:sugar:1.5'
- DBFlow
DBFlow 是基于 SQLite for Android 构建的快速、高效且功能丰富的 Kotlin 数据库库。 DBFlow 利用注解处理为您生成 SQLite 样板,并提供强大的 SQLite 查询语言,让使用 SQLite 成为一种乐趣。
kapt "com.github.agrosner.dbflow:processor:${dbflow_version}"
// Annotation Processor
// if only using Java, use this. If using Kotlin do NOT use this.
annotationProcessor "com.github.agrosner.dbflow:processor:${dbflow_version}"
// core set of libraries
implementation "com.github.agrosner.dbflow:core:${dbflow_version}"
implementation "com.github.agrosner.dbflow:lib:${dbflow_version}"
// sql-cipher database encryption (optional)
implementation "com.github.agrosner.dbflow:sqlcipher:${dbflow_version}"
implementation "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"
// RXJava 2 support
implementation "com.github.agrosner.dbflow:reactive-streams:${dbflow_version}"
// Kotlin Coroutines
implementation "com.github.agrosner.dbflow:coroutines:${dbflow_version}"
// Android Architecture Components Paging Library Support
implementation "com.github.agrosner.dbflow:paging:${dbflow_version}"
// Android Architecture Components LiveData Library Support
implementation "com.github.agrosner.dbflow:livedata:${dbflow_version}"
// adds generated content provider annotations + support.
implementation "com.github.agrosner.dbflow:contentprovider:${dbflow_version}"
事件分发相关
- EventBus
EventBus 是适用于 Android 和 Java 发布/订阅事件总线。非常值得阅读源代码
implementation("org.greenrobot:eventbus:3.3.1")
异步相关
- RxJava
一个使用可观察序列组成异步和基于事件的程序的库。
implementation 'io.reactivex.rxjava2:rxjava:2.0.5'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.5'
性能相关
- LeakCanary
LeakCanary是一个检测内存溢出的开源库
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
图表相关
- MPAndroidChart
一个强大的制作图表的开源库,支持 线图、饼状图、雷达图、气泡图等
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
其他
ButterKnife
ButterKnife是一个视图的绑定工具,通过注释生成一些相应的代码,更简洁的代码
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
Timber
Timber是一个开源的log框架
implementation 'com.jakewharton.timber:timber:5.0.1'
猜你喜欢
- 2024-12-08 我用Python的Seaborn库,绘制了17个超好看图表
- 2024-12-08 让人抓狂的游戏迷宫,锁妖塔、神魔之井、草海曾让我有轻生的念头
- 2024-12-08 分析 Android 耗电原理后,飞书是这样做耗电治理的
- 2024-12-08 在PieChart中间添加不同颜色不同大小的文字
- 2024-12-08 加工中心PMC编程实用案例4:手轮倍率
- 2024-12-08 8421编码开关如何使用,请看这里
- 2024-12-08 微信视频号,最后的风口
- 2024-12-08 又发现3个超好用的抠图神器!完全免费无需注册,打开就能用
- 2024-12-08 3分钟学会程序员“面试回答规范”,不怕找不到工作的里面请
- 2024-12-08 潍坊一高校连续五年摘得国赛“移动互联网应用软件开发”金牌
- 最近发表
- 标签列表
-
- cmd/c (90)
- c++中::是什么意思 (84)
- 标签用于 (71)
- 主键只能有一个吗 (77)
- c#console.writeline不显示 (95)
- pythoncase语句 (88)
- es6includes (74)
- sqlset (76)
- apt-getinstall-y (100)
- node_modules怎么生成 (87)
- chromepost (71)
- flexdirection (73)
- c++int转char (80)
- mysqlany_value (79)
- static函数和普通函数 (84)
- el-date-picker开始日期早于结束日期 (76)
- js判断是否是json字符串 (75)
- c语言min函数头文件 (77)
- asynccallback (87)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- java (73)
- js数组插入 (83)
- mac安装java (72)
- 无效的列索引 (74)