本文整理了安卓开发中常用的官方和三方库及其官网地址,方便同仁们进行查阅、技术选型和追更。这里罗列的库一般是星级较高、可靠性较好、维护中的库,所以在功能性、可靠性以及性能上通常是满足需求的。在技术选型时建议从以下几点进行考量:
- 扩展性:是否支持自定义功能拓展;
- 性能:是否需要极致性能要求;
- 安全性:是否具有安全漏洞;
- 技术支持:文档是否完备,更新频率等;
- 体积:是否对包体积具有极致要求;
如果有官方的库建议使用官方的,维护有保障,当然像
square
公司出品的几乎也可以认为是官方的了。
目录
AndroidX&Material
名称 | GAV | 官网 | 简介 |
---|---|---|---|
appcompat | androidx.appcompat:appcompat:1.1.0 | – | Dialog/activity/actionbar/menu等 |
cardview | androidx.cardview:cardview:1.0.0 | – | 卡片布局 |
material | com.google.android.material:material:1.1.0 | – | 卡片布局 |
lifecycle | androidx.lifecycle:lifecycle-extensions:2.2.0 | – | activity/fragment/service生命周期 |
constraintlayout | androidx.constraintlayout:constraintlayout:1.1.3 | – | 相对布局 |
coordinatorlayout | androidx.coordinatorlayout:coordinatorlayout:1.1.0 | – | 动画框架布局 |
swiperefreshlayout | androidx.swiperefreshlayout:swiperefreshlayout:1.1.0 | – | 下拉刷新 |
viewpager | androidx.viewpager:viewpager:1.0.0 | – | viewpager |
viewpager2 | androidx.viewpager2:viewpager2:1.0.0 | – | 基于recyclerview实现的viewpager |
fragment | androidx.fragment:fragment:1.2.0 | – | fragment |
activity | androidx.activity:activity:1.1.0 | – | activity |
drawerlayout | androidx.drawerlayout:drawerlayout:1.0.0 | – | 侧滑布局 |
recyclerview | androidx.recyclerview:recyclerview:1.1.0 | – | 列表 |
transition | androidx.transition:transition:1.2.0 | – | 转场动画 |
loader | androidx.loader:loader:1.0.0 | – | 异步加载 |
collection | androidx.collection:collection:1.1.0 | – | 经优化的List、Map、Set集合 |
annotation | androidx.annotation:annotation:1.1.0 | – | 常用注解 |
multidex | androidx.multidex:multidex:2.0.0 | – | 64K限制,minSDK21以下时需要手动导入 |
上面只列出了常见的,最全版本可以到这里查看
基础库
并发编程
名称 | GAV | 官网 | 简介 |
---|---|---|---|
rxjava2 | io.reactivex.rxjava2:rxjava:2.2.5 io.reactivex.rxjava2:rxandroid:2.1.0 org.reactivestreams:reactive-streams:1.0.2 | github | rxjava2 |
数据解析
名称 | GAV | 官网 | 简介 |
---|---|---|---|
fastjson | com.alibaba:fastjson:1.2.49 | github | json解析 |
gson | com.google.code.gson:gson:2.8.5 | github | json解析 |
jackson | com.fasterxml.jackson.core:jackson-core:2.8.9 com.fasterxml.jackson.core:jackson-annotations:2.8.0 com.fasterxml.jackson.core:jackson-databind:2.8.9 | github | json解析 |
LoganSquare | classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’ apply plugin: ‘com.neenbedankt.android-apt’ apt ‘com.bluelinelabs:logansquare-compiler:1.3.6’ compile ‘com.bluelinelabs:logansquare:1.3.6’ | github | json解析,编译期生成代码因此是静态的 |
simple-xml | org.simpleframework:simple-xml:2.7.1 | xml解析 | |
jsoup | org.jsoup:jsoup:1.14.1-SNAPSHOT | github | html操作 |
网络请求
名称 | GAV | 官网 | 简介 |
---|---|---|---|
retrofit | com.squareup.retrofit2:retrofit:2.7.1 com.squareup.retrofit2:converter-gson:2.3.0 com.squareup.retrofit2:adapter-rxjava2:2.3.0 com.squareup.retrofit2:converter-simplexml:2.3.0 | github | 网络请求 |
okhttp | com.squareup.okhttp3:okhttp:3.14.4 com.squareup.okhttp3:okhttp-urlconnection:3.9.1 | github | 网络请求 |
Java-WebSocket | org.java-websocket:Java-WebSocket:1.5.1 | github | WebSocket |
android-async-http | com.loopj.android:android-async-http:1.4.11 | github | 网络请求 |
volley | com.android.volley:volley:1.2.1-SNAPSHOT | github | 网络请求、图片加载 |
NoHttp | com.yanzhenjie.nohttp:nohttp:1.1.11 | github | 网络请求 |
Novate | com.tamic.novate:novate:1.5.5 | github | 网络请求 |
文件读写
名称 | GAV | 官网 | 简介 |
---|---|---|---|
okio | com.squareup.okio:okio:1.17.4 | 文件IO |
轻量级存储
名称 | GAV | 官网 | 简介 |
---|---|---|---|
MMKV | com.tencent:mmkv-static:1.2.10 | github | kv存储,基于mmap |
数据库
名称 | GAV | 官网 | 简介 |
---|---|---|---|
litepal | org.litepal.android:java:3.2.3 org.litepal.android:core:3.2.3 | github | 数据库 |
activeandroid | com.michaelpardo:activeandroid:3.1.0-SNAPSHOT | github | 数据库 |
ormlite-android | com.j256.ormlite:ormlite-android:5.7-SNAPSHOT | github | 数据库 |
greendao | classpath ‘org.greenrobot:greendao-gradle-plugin:3.3.0’ apply plugin: ‘org.greenrobot.greendao’ implementation ‘org.greenrobot:greendao:3.3.0’ | github | 数据库 |
realm | classpath “io.realm:realm-gradle-plugin:10.7.0-SNAPSHOT” apply plugin: ‘realm-android’ compileOnly ‘org.projectlombok:lombok:1.16.18’ compileOnly ‘javax.annotation:javax.annotation-api:1.3.1’ annotationProcessor ‘org.projectlombok:lombok:1.16.18’ | github | 数据库,虽然性能不错,但是包体积很大 |
日志记录
名称 | GAV | 官网 | 简介 |
---|---|---|---|
logger | com.orhanobut:logger:2.2.0 | github | 日志 |
timber | com.jakewharton.timber:timber:4.7.1 | github | 日志,价值在于日志类的抽象 |
LogUtils | com.apkfuns.logutils:library:1.7.5 | github | 日志,功能比较完备 |
xLog | com.elvishew:xlog:1.10.0 | github | 日志 |
Log4a | com.github.pqpo:Log4a:1.4.2 | github | 日志,基于mmap |
mars | com.tencent.mars:mars-wrapper:1.2.5 或者com.tencent.mars:mars-core:1.2.5 | github | 高性能日志 |
xCrash | com.iqiyi.xcrash:xcrash-android-lib:3.0.0 | github | java/native奔溃日志 |
图片加载
名称 | GAV | 官网 | 简介 |
---|---|---|---|
glide | com.github.bumptech.glide:glide:4.9.0 com.github.bumptech.glide:gifdecoder:4.9.0 com.github.bumptech.glide:disklrucache:4.9.0 com.github.bumptech.glide:annotations:4.9.0 com.github.bumptech.glide:compiler:4.9.0 | github | 图片加载 |
glide-transformations | jp.wasabeef:glide-transformations:4.0.0 jp.co.cyberagent.android:gpuimage:2.0.4 | glide拓展 | |
picasso | com.squareup.picasso:picasso:2.71828 | github | 图片加载 |
fresco | com.facebook.fresco:fresco:2.5.0 | github | 图片加载,体积较大 |
Android-Universal-Image-Loader | com.nostra13.universalimageloader:universal-image-loader:1.9.5 | github | 图片加载 |
事件总线
名称 | GAV | 官网 | 简介 |
---|---|---|---|
eventbus | org.greenrobot:eventbus:3.1.1 | github | 事件总线 |
eventbus | org.simple:androideventbus:1.0.5.1 | github | 事件总线,不再维护 |
otto | com.squareup:otto:1.3.8 | github | 事件总线,不再维护 |
js通讯
名称 | GAV | 官网 | 简介 |
---|---|---|---|
jsbridge | com.github.lzyzsd:jsbridge:1.0.4 | github | js通讯,不再维护 |
DSBridge-Android | com.github.wendux:DSBridge-Android:3.0-SNAPSHOT or x5: com.github.wendux:DSBridge-Android:x5-3.0-SNAPSHOT | github | js通讯 |
AgentWeb | implementation ‘com.github.Justson.AgentWeb:agentweb-core:v4.1.9-androidx’ // (必选) implementation ‘com.github.Justson.AgentWeb:agentweb-filechooser:v4.1.9-androidx’ // (可选) implementation ‘com.github.Justson:Downloader:v4.1.9-androidx’ // (可选) | github | h5容器 |
其他
名称 | GAV | 官网 | 简介 |
---|---|---|---|
utilcode | com.blankj:utilcode:1.30.0 | github | SDK封装,也支持事件总线、日志记录、并发编程等 |
架构
组件化
名称 | GAV | 官网 | 简介 |
---|---|---|---|
ARouter | classpath “com.alibaba:arouter-register:1.0.2” compile ‘com.alibaba:arouter-api:1.5.2’ annotationProcessor ‘com.alibaba:arouter-compiler:1.5.2’ | github | SDK封装,也支持事件总线、日志记录、并发编程等 |
插件化
名称 | GAV | 官网 | 简介 |
---|
AOP/IOC
依赖注入和插装
名称 | GAV | 官网 | 简介 |
---|---|---|---|
dagger | com.google.dagger:dagger-android:2.x com.google.dagger:dagger-android-processor:2.x | github | 依赖注入 |
androidannotations | org.androidannotations:androidannotations:version org.androidannotations:androidannotations-api:version | github | 依赖注入 |
hunter-okhttp | com.quinn.hunter:hunter-okhttp-library:0.8.5 插件:com.quinn.hunter:hunter-okhttp-plugin:0.9.2 | github | okhttp钩子 |
xHook | 无 | github | native钩子 |
aspectjx | classpath ‘com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.8’ | github | 增强版aspectj |
插桩工具链
名称 | GAV | 官网 | 简介 |
---|---|---|---|
javapoet | com.squareup:javapoet:1.7.0 | java文件生成 | |
kotlinpoet | com.squareup:kotlinpoet:1.9.0 | github | kotlin文件生成 |
javassist | org.javassist:javassist:3.28.0-GA | github | java、字节码 |
asm | org.ow2.asm:asm:9.2 | 官网 | 字节码 |
aspectj | org.aspectj:aspectjweaver:1.9.7 | 官网 github | java |
功能库
名称 | GAV | 官网 | 简介 |
---|---|---|---|
keeplive | com.fanjun:keeplive:1.1.20 | 应用层进程保活 | |
permission | com.yanzhenjie.permission: x:2.0.1 | 动态权限 | |
rxpermissions | com.tbruyelle.rxpermissions2:rxpermissions:0.9.5 | 动态权限 | |
rxlifecycle-android | com.trello.rxlifecycle2:rxlifecycle-android:2.2.1 | rx生命周期 | |
zxing | com.google.zxing:core:3.3.3 com.google.zxing:android-core:3.3.0 | github | 二维码编解码 |
jjwt | io.jsonwebtoken:jjwt:0.9.0 | github | token工具 |
pinyin4j | com.belerweb:pinyin4j:2.5.0 | github | 拼音 |
tinypinyin | com.github.promeg:tinypinyin:2.0.3 com.github.promeg:tinypinyin-android-asset-lexicons:2.0.3 com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3 | github | 拼音 |
PersistentCookieJar | com.github.franmontiel:PersistentCookieJar:v1.0.1 | github | cookie持久化 |
Matisse | com.zhihu.android:matisse:0.5.3-beta3 | github | 图片选择 |
easyexcel | com.alibaba:easyexcel:2.2.10 | github | Excel操作 |
dexmaker | com.linkedin.dexmaker:dexmaker-mockito:2.28.1 | github | class代理 |
FingerprintIdentify | com.github.uccmawei:FingerprintIdentify:1.2.6 | github | 指纹识别封装 |
控件库
名称 | GAV | 官网 | 简介 |
---|---|---|---|
qmui | com.qmuiteam:qmui:1.4.4 | github | 基础控件库 |
bga-banner | cn.bingoogolapple:bga-banner:3.0.0 | banner轮播图 | |
materialrefreshlayout | com.cjj.materialrefreshlayout:library:1.3.0 | 下拉刷新 | |
SmartRefreshLayout | com.scwang.smartrefresh:SmartRefreshLayout:1.1.0 | github | 下拉刷新&加载更多 |
recyclerview | com.yanzhenjie.recyclerview: x:1.3.2 | 增强recyclerview :loadmore、sticky、侧滑菜单等 | |
recyclerview | com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46 | 增强recyclerview :通用adapter | |
ultimaterecyclerview | com.marshalchen.ultimaterecyclerview:library:0.9.0 | github | 增强recyclerview:可折叠 |
recyclerview-animators | jp.wasabeef:recyclerview-animators:4.0.2 | github | recyclerview 动画 |
easyrecyclerview | com.jude:easyrecyclerview:4.4.2 | 增强recyclerview | |
PhotoView | com.github.chrisbanes:PhotoView:2.1.4 | 图片缩放 | |
photoview | com.github.chrisbanes.photoview:library:1.2.4 | 图片缩放 | |
imagezoom | it.sephiroth.android.library.imagezoom:library:1.0.4 it.sephiroth.android.library.easing:library:1.0.2 | 图片缩放 | |
android-pdf-viewer | com.github.barteksc:android-pdf-viewer:2.8.2 com.github.barteksc:pdfium-android:1.7.1 | PDF预览(有高级安全漏洞不建议实用) | |
ticketview: | com.vipulasri:ticketview:1.0.7 | 仿票据背景布局 | |
flowlayout-lib | com.hyman:flowlayout-lib:1.1.2 | 流式布局 | |
flexbox | com.google.android:flexbox:1.1.0 | 流式布局&recyclerview拓展 | |
loading | com.yanzhenjie:loading:1.0.2 | 加载动画 | |
LoadingDrawable | 无 | github | 加载动画,不再维护但是我个人非常推崇drawable形式 |
gridPasswordView | com.jungly:gridPasswordView:0.3 | github | 密码、短信验证码输入框 |
NotifyUtil | 无 | github | 玩转安卓通知栏通知 |
ExpansionPanel | com.github.florent37:expansionpanel:1.2.4 | github | 动画展开/收起容器 |
VerticalTabLayout | q.rorbin:VerticalTabLayout:1.2.5 | github | 纵向tablayout |
Skeleton | com.ethanhua:skeleton:1.1.2 io.supercharge:shimmerlayout:2.1.0 | github | 骨架加载 |
XPopup | com.github.li-xiaojun:XPopup:2.4.3 | github | 弹窗框架 |
NewbieGuide | com.github.huburt-Hu:NewbieGuide:v2.4.0 | github | 引导页 |
lottie-android | com.airbnb.android:lottie:3.7.1-SNAPSHOT | github | 引导页 |
开放平台SDK
名称 | GAV | 官网 | 简介 |
---|---|---|---|
未上传到仓库 | https://connect.qq.com | QQ互联SDK | |
ddsharesdk | com.alibaba.android:ddsharesdk:1.1.0 | https://ding-doc.dingtalk.com/ | 钉钉分享 |
wechat-sdk-android | com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1 | https://open.weixin.qq.com/ | 微信开发SDK |
gms | com.google.android.gms:play-services-measurement-api:17.2.0 com.google.android.gms:play-services-base:17.0.0 com.google.android.gms:play-services-tasks:17.0.0 com.google.android.gms:play-services-measurement:17.2.0 com.google.android.gms:play-services-measurement-sdk:17.2.0 com.google.android.gms:play-services-measurement-impl:17.2.0 com.google.android.gms:play-services-stats:17.0.0 com.google.android.gms:play-services-measurement-sdk-api:17.2.0 com.google.android.gms:play-services-measurement-base:17.2.0 com.google.android.gms:play-services-ads-identifier:17.0.0 com.google.android.gms:play-services-basement:17.0.0 | https://firebase.google.com/docs/android | 谷歌FCM推送 |
firebase | com.google.firebase:firebase-messaging:20.0.0 com.google.firebase:firebase-core:17.2.0 com.google.firebase:firebase-analytics:17.2.0 com.google.firebase:firebase-iid:20.0.0 com.google.firebase:firebase-common:19.0.0 com.google.firebase:firebase-iid-interop:17.0.0 com.google.firebase:firebase-measurement-connector:18.0.0 | https://firebase.google.cn/ | 谷歌firebase |
umeng | com.umeng.umsdk:push:6.0.1 com.umeng.umsdk:asms:1.1.3 com.umeng.umsdk:common:9.1.0 com.umeng.umsdk:crash:0.0.4 com.umeng.umsdk:oaid_vivo:1.0.0.1 com.umeng.umsdk:oaid_oppo:1.0.4 com.umeng.umsdk:oaid_mi:1.0.0 com.umeng.umsdk:oaid_lenovo:1.0.0 | https://www.umeng.com/push | 友盟推送 |