Android常用框架

article/2025/9/24 11:36:35

常用框架
1.缓存框架
    1.1DiskLruCache:Java实现基于LRU的磁盘缓存,DiskLruCache不是google官方所写,但是得到了官方推荐,DiskLruCache没有编写到SDK中去,如需使用可直接copy这个类到项目中去。使用场景:如“清除缓存”,DiskLruCache一句话就可以搞定!
github https://github.com/JakeWharton/DiskLruCache
作者:JakeWharton
使用:implementation ‘com.jakewharton:disklrucache:2.0.2’
    1.2LruCache:Android 3.1的时候出现的,一般我们为了兼容低版本会使用v4包下的。LruCache是一种缓存策略,持有的是强引用,但是会控制在一个峰值下。它内部维护了一个队列,每当从中取出一个值时,该值就移动到队列的头部。当缓存已满而继续添加时,会将队列尾部的值移除,方便GC。LruCache用于内存缓存,在避免程序发生OOM和提高执行效率有着良好表现。
2.图片加载
    2.1Android Universal Image Loader:UIL曾经的图片加载框架王者,android开发老手都用过它。提供了大量配置方式,图片加载状态的回调(成功,失败,进行中),加载动画等;以及提供了移动端图片加载框架的缓存思路:三级缓存策略 sd卡-内存-网络;
github https://github.com/nostra13/Android-Universal-Image-Loader
作者 nostra13
使用:
implementation ‘com.nostra13.universalimageloader:universal-image-loader:1.9.5’
    2.2Picasso: 强力的图片下载、缓存框架。
更强调图片下载,你可以将picasso集成进你的项目中,你也可以结合gilde和UIL与picasso,三者一齐封装至你的项目中,按需所用。
github https://github.com/square/picasso
作者 square团队
使用:
implementation ‘com.squareup.picasso:picasso:2.5.2’
    2.3Fresco: 可以管理图片内存的框架
在管理图片内存领域上有着它的一片天地,渐进式加载、加载gif。
官网地址: https://www.fresco-cn.org/
github https://github.com/facebook/fresco
作者 facebook
使用:
implementation ‘com.facebook.fresco:fresco:0.12.0’
下面的依赖需要根据需求添加:
// 在 API < 14 上的机器支持 WebP 时,需要添加
implementation 'com.facebook.fresco:animated-base-supp
    2.4Glide: 是一款专注于提供流畅划动能力的“图片加载和缓存框架”
图片加载类框架排名第一的框架,google 在2014开发者大会上演示的camera app就是基于gilde框架开发的
地址:
github https://github.com/bumptech/glide
作者 Bump Technologies团队
使用:
implementation ‘com.github.bumptech.glide:glide:4.5.0’
3.图片处理
    3.1 Picasso-transformations: Picasso提供多种图片变换的库。
地址:github https://github.com/wasabeef/picasso-transformations
作者 square团队
使用:
implementation ‘jp.wasabeef:picasso-transformations:2.1.0’
// If you want to use the GPU Filters
implementation ‘jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1’
     3.2Glide-transformations: 为众多著名图片加载框架(glide,Picasso,Fresco等)提供图片形状变幻能力的框架 。
github https://github.com/wasabeef/glide-transformations
作者:Daichi Furiya
使用:
implementation ‘jp.wasabeef:glide-transformations:2.0.2’
// If you want to use the GPU Filters
implementation ‘jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1’
    3.3Android-gpuimage: 一款基于OpenGL的图片渲染引擎,Android版的android-gpuimage就提供多达70多种图片渲染效果,你还在好奇美图秀秀是如何实现图片变幻的?有了它,一 切都不是问题。如果你是美图工具类的工程师,此框架的建设思路也会对你大有裨益。
github:https://github.com/CyberAgent/android-gpuimage
作者:CyberAgent 团队
使用:
implementation ‘jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1’
4.网络请求
     4.1Android Async HTTP: 一款基于Http协议的异步请求的网络框架。
github https://github.com/loopj/android-async-http

作者:James Smith

使用:
implementation ‘com.loopj.android:android-async-http:1.5.0-SNAPSHOT’
     4.2AndroidAsync: 异步Socket,HTTP(客户端+服务器),WebSocket,和socket.io库。基于NIO而不是线程。
地址:https://github.com/koush/AndroidAsync/tree/master/AndroidAsync/src/com/koushikdutta/async
使用:
implementation ‘com.koushikdutta.async:androidasync:2.+’
    4.3OkHttp : okhttp是一款基于HTTP和HTTP2.0协议的网络框架,服务于java和android客户端,专注网络请求的安全高效。
地址 http://square.github.io/okhttp/
github https://github.com/square/okhttp
作者:square团队
使用:
implementation ‘com.squareup.okhttp3:okhttp:3.8.0’
    4.4Retrofit:
一款类型安全的网络框架,基于HTTP协议,服务于Android和java语言。
Retrofit2.0开始内置okhttp框 架,Retrofit专注封装接口完成业务需求,okhttp专注网络请求的安全高效
地址
github https://github.com/square/retrofit
作者:square团队
使用:
implementation ‘com.squareup.retrofit2:retrofit:2.3.0’
    4.5Volley: google推荐使用的Android端网络请求框架
github https://github.com/google/volley
作者:google
5.数据解析:
    5.1Gson:Gson是谷歌官方推出的支持 JSON – Java Object 相互转换的 Java序列化/反序列化 库。
地址:
github https://github.com/google/gson
作者:google
使用:
implementation ‘com.google.code.gson:gson:2.8.4’
    5.2Jackson: 相对来说比较高效,在项目中主要使用Jackson进行JSON和Java对象转换。
地址:
github https://github.com/codehaus/jackson
使用:
compile ‘org.codehaus.jackson:jackson-mapper-asl:1+’
compile ‘org.codehaus.jackson:jackson-core-asl:1+’
    **5.3Fastjson:**一款基于json解析、生成的框架,快速是它最大的特性,阿里巴巴的出身保证了代码的质量和优越。
github https://github.com/alibaba/fastjson
作者:alibaba
使用:
compile ‘com.alibaba:fastjson:1.1.58.android’
    5.4:HtmlPaser 一个用来解析 HTML 文档的开放源码项目,提供了强大的 API 实现对 Html 网页进行信息转换 (Transformation) 以及从 HTML 文档里提取 (Extraction) 感兴趣的信息。它具有小巧、快速、使用简单的特点,并且经过严格的测试。
    5.5Jsoup: 方便的增删查改HTML中的元素
地址:
https://github.com/jhy/jsoup
使用:
compile ‘org.jsoup:jsoup:1.9.2’

6.数据库
    6.1OrmLite: JDBC和Android的轻量级ORM java包
地址:
https://github.com/j256/ormlite-core
https://github.com/j256/ormlite-android
使用:
compile ‘com.j256.ormlite:ormlite-android:5.0’
compile ‘com.j256.ormlite:ormlite-core:5.0’
     6.2Sugar : 用超级简单的方法处理Android数据库,不用写复杂的sql语句,而用简单的API即可完成创建和操纵数据
地址:
https://github.com/chennaione/sugar
使用:
compile ‘com.github.satyan:sugar:1.3’
    6.3GreenDAO: 是一款高效、快速的SQLite型数据库
,号称Android最快的关系型数据库支持数据库加密 greendao支持SQLCipher进行数据库加密
github https://github.com/greenrobot/greenDAO
使用:
classpath ‘com.android.tools.build:gradle:2.3.1’
classpath ‘org.greenrobot:greendao-gradle-plugin:3.2.2’ // add plugin
     6.4ActiveAndroid: 极大的简化数据库的使用,使用面向对象的方式管理数据库,告别手写SQL历史。每一个数据库表都可以映射为一个类。
地址:
https://github.com/pardom-zz/ActiveAndroid
使用:
compile ‘com.michaelpardo:activeandroid:3.1.0-SNAPSHOT’
     6.5SQLBrite: 响应式数据库框架,对 Android 系统的SQLiteOpenHelper和 ContentResolver 的轻量级封装,配合Rxjava使用。
https://github.com/square/sqlbrite
使用:
compile ‘com.squareup.sqlbrite:sqlbrite:0.7.0’
在处理线程问题时,由于要使用到RxAndorid中相关的类,所以我们还要引入
compile ‘io.reactivex:rxandroid:1.1.0’
    6.6Realm: 是一款移动端数据库框架,核心数据引擎C++打造,比普通的Sqlite型数据库快的多。
地址:github https://github.com/realm/realm-java
作者:Realm团队
使用:
compile ‘org.jsoup:jsoup:1.11.3’
7.依赖注入
    7.1ButterKnife: 提供了一种能力——使用注解生成模板代码,将view与方法和参数绑定。帮助开发者省却了频繁findviewbyid的烦恼,最新的Butter Knife还提供了onclick绑定以及字符串的初始化。
github:https://github.com/JakeWharton/butterknife
作者:JakeWharton ,也是square团队成员之一
使用:
compile ‘com.jakewharton:butterknife:8.6.0’
annotationProcessor ‘com.jakewharton:butterknife-compiler:8.6.0’
     7.2Dagger2 : 一款通过依赖注入降低程序间耦合的开发框架,如今google团队接手的dagger2版本,强力开发团队保证了代码在 设计上的优越性
github :https://github.com/google/dagger

作者:google
使用:
dependencies {
compile ‘com.google.dagger?2.x’
annotationProcessor ‘com.google.dagger:dagger-compiler:2.x’
}
//If you’re using classes in dagger.android you’ll also want to include:
compile ‘com.google.dagger:dagger-android:2.x’
compile ‘com.google.dagger:dagger-android-support:2.x’
annotationProcessor ‘com.google.dagger:dagger-android-processor:2.x’
    7.3AndroidAnotations : 可以加速Android的开发。它负责管道,让你专注于真正重要的事情。通过简化代码,它简化了代码的维护。
https://github.com/androidannotations/androidannotations
使用:
dependencies {
annotationProcessor “org.androidannotations:androidannotations:2.7”
compile “org.androidannotations:androidannotations-api:2.7”
}
8.图表
    8.1WilliamChart: Android图表库,已支持的功能,折线图
,条形图,横向条形图,堆叠柱形图,横向堆叠柱形图
https://github.com/diogobernardino/WilliamChart
使用:
compile ‘com.diogobernardino:williamchart:2.2’
    8.2HelloCharts: 一个用来生成统计图表的三方库,目前支持折线图、柱状图和饼状图等常见图表。支持缩放、滑动和动画效果。
https://github.com/lecho/hellocharts-android
使用:
compile ‘com.github.lecho:hellocharts-library:1.5.8@aar’
    8.3MPAndroidChart : 快速、简洁。强大著称的图表框架
github https://github.com/PhilJay/MPAndroidChart
作者:PhilJay
使用:
compile ‘com.github.PhilJay:MPAndroidChart:v3.0.2’
9.后台处理
    9.1Tape: Android和Java中使用的与队列类相关的集合类,轻快的、事务性的、基于文件的FIFO(先进先出)

https://github.com/square/tape
使用:
compile ‘com.squareup.tape2:tape:2.0.0-beta1’
    9.2Android Priority Job Queue: 提供后台任务管理能力的框架,不论是Activity重新加载、Service使用线程池时的任务优先级和并发问题,都不要担心,Job Manage会照顾优先级,持久性,负载平衡,延迟,网络控制,分组,优秀的多线程管理能力。
github https://github.com/yigit/android-priority-jobqueue
作者:Yigit Boyar
compile ‘com.birbit:android-priority-jobqueue:2.0.1’
10. 事件总线
    10.1EventBus: 是一款本地组件间通信框架,在大型项目的Activities,fragments,Threads,Services都可以看到它的使用场景,尽管 EventBus在向未创建的组件传递事件时有些局限,仅适合在“活着的”组件间传递消息,但仍不妨碍它活跃在各个大型项目各个场景里。
github https://github.com/greenrobot/EventBus
作者 greenrobot
使用:
compile ‘org.greenrobot:eventbus:3.0.0’
    10.2Otto: 一款老旧且强大的事件总线框架。是 square团队早先推出的事件响应型框架,淘宝app的事件驱动也是基于此框架封装的,如今square已经建议开发者采用RxJava RxAndroid来代替otto了。
github https://github.com/square/otto
作者:square
使用:
compile ‘com.michaelpardo:activeandroid:3.1.0-SNAPSHOT’
11. 响应式编程
    11.1RxJava: 一款Android客户端组件间异步通信的框架,RxAndroid是用来取代AnsyTask的。
github https://github.com/ReactiveX/RxAndroid
作者 JakeWharton
使用:
compile ‘io.reactivex.rxjava2:rxandroid:2.0.1’
compile ‘io.reactivex.rxjava2:rxjava:2.1.0’
    11.2RxJavaJoins: RxJava提供Joins操作(排列组合效果)
https://github.com/ReactiveX/RxJavaJoins
使用:
compile ‘io.reactivex:rxjava-joins:0.22.0’
    11.3RxAndroid: 一款Android客户端组件间异步通信的框架
https://github.com/ReactiveX/RxAndroid
使用:
compile ‘io.reactivex.rxjava2:rxandroid:2.0.1’
compile ‘io.reactivex.rxjava2:rxjava:2.1.5’
    **11.4RxBinding:**一款提供UI组件事件响应能力的框架,通过RXBinding,你将理解响应式编程的快乐,让项目里的事件流程更清晰。
github https://github.com/JakeWharton/RxBinding

作者:JakeWharton
使用:
Platform bindings:
compile ‘com.jakewharton.rxbinding2:rxbinding:2.0.0’
‘support-v4’ library bindings:

compile ‘com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0’
‘appcompat-v7’ library bindings:

compile ‘com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0’
‘design’ library bindings:

compile ‘com.jakewharton.rxbinding2:rxbinding-design:2.0.0’
‘recyclerview-v7’ library bindings:

compile ‘com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.0.0’
‘leanback-v17’ library bindings:

compile ‘com.jakewharton.rxbinding2:rxbinding-leanback-v17:2.0.0’
    11.5Agera: google专门推出一套响应式编 程框架服务于Android开发者,相比于之响应式编程框架榜首的 RxJava RxAndroid,它更轻量,两者最大的不同点在于agera基于push event、pull data (VS Rx系列 push data)。
github https://github.com/google/agera
作者:Google
使用:
compile ‘com.google.android.agera:agera:1.3.0’
扩展能力
compile ‘com.google.android.agera:content:1.3.0’
compile ‘com.google.android.agera:database:1.3.0’
compile ‘com.google.android.agera:net:1.3.0’
compile ‘com.google.android.agera:rvadapter:1.3.0’
compile ‘com.google.android.agera:rvdatabinding:1.3.0’
12. Log框架
     12.1Logger: 一款让log日志优雅显示的框架。它最大的亮点是优雅的输出log信息,并且支持多种格式:线程、Json、Xml、List、Map等
github https://github.com/orhanobut/logger
作者:Orhan Obut
使用:
compile ‘com.orhanobut:logger:2.1.1’
13. 测试框架
    **13.1Mockito ?*用简洁的API做测试。而且Mockito简单易学,它可读性强和验证语法简洁。
API文档:http://docs.mockito.googlecode.com/hg/org/mockito/Mockito.html
https://github.com/mockito/mockito
    **13.2Robotium:**面向Android端的开源自动化测试框架,Robotium结合Android自身提供的测试框架可以对应用程序进行自动化测试。另外,Robotium还支持对WebView的操作。Robotium的核心类是Solo,通过Solo可以对控件进行各种操作。
https://github.com/RobotiumTech/robotium
    **13.3Robolectric:**一款不依赖于Android设备的单元测试框架。
github https://github.com/robolectric/robolectric
作者:robolectric
使用:
testCompile “org.robolectric:robolectric:3.3.2”
14. 调试框架
    **14.1Stetho:**一款提供在Chrome开发者工具上调试Android app能力的开源框架
ithub https://github.com/facebook/stetho
使用:
compile ‘com.facebook.stetho:stetho:1.5.0’
15. 性能优化
     **15.1LeakCanary :**一款内存检测框架,服务于java和android客户端,最大的特点,只需在应用的apllication中集成,就可以直接使用它;
github https://github.com/square/leakcanary
作者 square团队
使用:
debugCompile ‘com.squareup.leakcanary:leakcanary-android:1.5.1’
releaseCompile ‘com.squareup.leakcanary:leakcanary-android-no-op:1.5.1’
testCompile ‘com.squareup.leakcanary:leakcanary-android-no-op:1.5.1’

    15.2ACRA: 一款提供记录APP崩溃日志能力的框架,acra有足够的能力记录线上APP,并且发回服务端,acra也提供了相当棒的崩溃日志统计服务端框架Acralyzer,cralyzer工作在Apache CouchDB
github https://github.com/ACRA/acra
服务端github https://github.com/ACRA/acralyzer
作者:acra团队


http://chatgpt.dhexx.cn/article/5S9wKqOc.shtml

相关文章

Android开发框架大全

包括各种快速开发框架、测试框架、系统框架、插件补丁框架、设计模式框架、主题切换框架。 android-tips-tricks&#xff1a; https://github.com/nisrulz/android-tips-tricks Android 开发的一些 Tips 集合 Android-Code-Style&#xff1a; https://github.com/LoranWong/And…

Android开发常用开源框架

Android开源框架系列 Android开源项目 Android开发常用开源框架2 Android开发常用开源框架3 GitHub上最火的Android开源项目,所有开源项目都有详细资料和配套视频 2017年伊始&#xff0c;你需要尝试的25个Android第三方库 Android开发常用第三方平台 免费的计算机编程类中…

Android开发框架模式(MVC、MVP、MVVM)实例解析

Android项目中&#xff0c;尤其是比较大型的项目开发中&#xff0c;模块内部的高聚合和模块间的低耦合性就显得尤为重要了。所以我们一般情况下需要为项目设计一种框架模式&#xff0c;通常情况下我们一般用到的三种MVC、MVP、MVVM。 通过框架模式设计的项目能够极大的提高开发…

LDA主题模型评估方法–Perplexity

在LDA主题模型之后,需要对模型的好坏进行评估,以此依据,判断改进的参数或者算法的建模能力。 Blei先生在论文《Latent Dirichlet Allocation》实验中用的是Perplexity值作为评判标准。 一、Perplexity定义 源于wiki:http://en.wikipedia.org/wiki/Perplexity perplexity是一…

LDA困惑度perplexity的一些个人理解

纠结这个问题很久了&#xff0c;期间主要去了gensim的google论坛&#xff0c;以及在StackOverflow、StackexChange用关键词topic number perplexity搜了下&#xff0c;得到这些很模糊的认识&#xff1a; 1. gensim的log_perplexity()解读&#xff1a; 根据gensim3.8.3的源码&…

NLP基础知识点:困惑度(Perplexity)

本篇内容翻译自Speech and Language Processing. Daniel Jurafsky & James H. Martin. 链接&#xff1a;https://web.stanford.edu/~jurafsky/slp3/ 不愧是自然语言处理领域的圣经&#xff0c;读起来流畅自然&#xff0c;以后还是要多读经典。 困惑度&#xff08;Perplexit…

Python LDA gensim 计算 perplexity

转载自 https://blog.csdn.net/qq_23926575/article/details/79472742 1.LDA主题模型困惑度 这部分参照&#xff1a;LDA主题模型评估方法–Perplexity&#xff0c;不过后面发现这篇文章Perplexity(困惑度)感觉写的更好一点&#xff0c;两篇都是翻译的维基百科。 perplexity是一…

困惑度 (perplexity)

困惑度 (perplexity) 在自然语言处理中,对于一个语言模型,一般用困惑度来衡量它的好坏,困惑度越低,说明语言模型面对一句话感到困惑的程度越低,语言模型就越好。 对于LDA模型,最常用的两个评价方法困惑度(Perplexity)、相似度(Corre)。 其中困惑度可以理解为对于一篇…

Metric评价指标-Perplexity语言模型

欢迎关注知乎&#xff1a; 世界是我改变的 知乎上的原文链接 一. 原理介绍 在研究生实习时候就做过语言模型的任务&#xff0c;当时让求PPL值&#xff0c;当时只是调包&#xff0c;不求甚解&#xff0c;哈哈哈&#xff0c;当时也没想到现在会开发这个评价指标&#xff0c;那现…

perplexity和预训练时用的loss的区别

Perplexity和预训练时用的loss都是用来评估语言模型的性能的指标&#xff0c;但是它们的计算方式和意义有所不同。 Perplexity是一种用来衡量语言模型对一个测试集的预测能力的指标。它的计算方式是将测试集中的所有句子输入到语言模型中&#xff0c;计算每个句子的困惑度&…

技术干货 | 基于MindSpore详解Perplexity语言模型评价指标

01 原理介绍 在研究生实习时候就做过语言模型的任务&#xff0c;当时让求PPL值&#xff0c;当时只是调包&#xff0c;不求甚解&#xff0c;哈哈哈&#xff0c;当时也没想到现在会开发这个评价指标&#xff0c;那现在我来讲一下我对这个指标的了解&#xff0c;望各位大佬多多指…

Perplexity定义

Refer from http://blog.csdn.net/pipisorry/article/details/42460023 http://blog.csdn.net/pipisorry/article/details/42460023 熵/信息熵 Perplexity定义 perplexity是一种信息理论的测量方法&#xff0c;b的perplexity值定义为基于b的熵的能量&#xff08;b可以是一个概…

gensim---LDA---perplexity

以下内容来源于https://blog.csdn.net/qq_25073545/article/details/79773807 使用gensim实现lda&#xff0c;并计算perplexity&#xff08; gensim Perplexity Estimates in LDA Model&#xff09; Neither. The values coming out of bound() depend on the number of topi…

世界上第一个会话搜索引擎——Perplexity AI使用测评

引言 比起传统的列表式搜索&#xff0c;Perplexity AI把艳惊四座的ChatGPT和必应搜索结合起来&#xff0c;既有ChatGPT式的问答&#xff0c;又像普通搜索引擎那样列出链接&#xff0c;就连马斯克也亲自称赞&#xff1a;它不仅总结出了推文的由来&#xff0c;还将推文的内容解释…

主题模型TopicModel:LDA主题模型的评估

http://blog.csdn.net/pipisorry/article/details/42460023 基础知识&#xff1a;熵 [熵与互信息] 皮皮blog Perplexity定义 perplexity是一种信息理论的测量方法&#xff0c;b的perplexity值定义为基于b的熵的能量&#xff08;b可以是一个概率分布&#xff0c;或者概率模型…

语言模型常用评价方法:perplexity、bleu

目录 1. perplexity&#xff08;困惑度、复杂度&#xff09; 2. BLEU 代码实现 1. perplexity&#xff08;困惑度、复杂度&#xff09; 更多详细&#xff0c;参考&#xff1a;详解语言模型NGram及困惑度Perplexity 语言模型&#xff1a;语言模型可以表示为一个计算 的模型&a…

LDA主题模型绘制困惑度(perplexity)-主题数曲线——python

主题建模作为一种基于机器学习的文本内容分析技术&#xff0c;一般用于推断文本文档中隐藏主题的技术。很多研究使用了基于Latent Dirichlet Allocation (LDA)的主题建模算法来处理大规模文档并识别潜在主题。LDA主题模型已经在多个研究领域得到应用&#xff0c;且都有着不俗表…

Android keystore

1.keystore是一个密钥库&#xff0c;密钥库中可以放很多对密钥对&#xff08;私钥证书(证书中包含公钥&#xff0c;数字签名,证书有效期&#xff0c;组织机构名称&#xff0c;申请时间&#xff0c;算法等。)&#xff09;kestore中有两种密码&#xff0c;一个密码是访问密钥库的…

查看KeyStore的信息,(本地的和线上的)

本地的&#xff1a; 1.找到jdk路径、如图 输入cmd 2.输入&#xff1a;keytool -list -v -keystore C:\Users\j\Desktop\app-android-v1.6-1caec749d84e708f91fd90ab383e42d7b417a47e\你的名.keystore 注意&#xff1a;C:\Users\j\Desktop\app-android-v1.6-1caec749d84e708f9…

Keystore与Truststore的区别

Keystore vs Truststore 概念 Keystore 用于存储特定程序应提供给双方&#xff08;服务器或客户端&#xff09;以进行验证的私钥和身份证书。 Truststore 用于存储来自认证机构 (CA) 的证书&#xff0c;这些证书验证服务器在 SSL 连接中提供的证书。 区别 KeystoreTruststo…