Gradle笔记——Android开发经常使用的Gradle依赖

在平常的Android开发确定少不了Android的build.gradle文件配置,下面是我收集经常使用的依赖配置,每一个月会更新一次。java

开发环境

JDK环境:JDK1.8。
编译器:Android Studio3.0以上。react

配置Java8依赖

大部分依赖都要支持Java8。android

compileOptions {
  sourceCompatibility JavaVersion.VERSION_1_8
  targetCompatibility JavaVersion.VERSION_1_8
}

AndroidX

如今Android开发项目,大部分建立都是默认支持AndroidX。git

implementation 'androidx.appcompat:appcompat:1.1.0'

Constraintlayout(约束布局)

如今Android开发大部分都使用约束布局。github

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Retrofit网络请求

GitHub地址 https://github.com/square/retrofitweb

// Retrofit2.0所需依赖
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
// 接口返回Json数据转为实体类所需依赖
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
// 结果转为基本类型所需依赖
implementation 'com.squareup.retrofit2:converter-scalars:2.4.0'

OkHttp网络请求

GitHub地址 https://github.com/square/okhttp数据库

implementation 'com.squareup.okhttp3:okhttp:4.1.1'
implementation 'com.squareup.okio:okio:2.2.2'

OkGo网络请求

GitHub地址 https://github.com/jeasonlzy/okhttp-OkGojson

//必须使用
implementation 'com.lzy.net:okgo:3.0.4'

//如下三个选择添加,okrx和okrx2不能同时使用
implementation 'com.lzy.net:okrx:1.0.2'
implementation 'com.lzy.net:okrx2:2.0.2'  
implementation 'com.lzy.net:okserver:2.0.5'

RxHttp网络请求

GitHub地址 https://github.com/liujingxing/RxHttpapi

// Rxhttp网络请求
implementation 'com.rxjava.rxhttp:rxhttp:1.1.6'
// 注解处理器,生成RxHttp类
annotationProcessor 'com.rxjava.rxhttp:rxhttp-compiler:1.1.6'
// 页面销毁,关闭请求,非必须
implementation 'com.rxjava.rxlife:rxlife:1.0.9'

RxJava

GitHub地址 https://github.com/ReactiveX/RxJava服务器

// RxJava2
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'

// RxJava3
implementation "io.reactivex.rxjava3:rxjava:3.0.0-RC2"

RxAndroid

GitHub地址 https://github.com/ReactiveX/RxAndroid

implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

小刀注解(黄油刀)

GitHub地址 https://github.com/JakeWharton/butterknife

 // 组件视图绑定依赖,黄油刀
 implementation 'com.jakewharton:butterknife:10.1.0'
 annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'

Design依赖,谷歌推荐的界面风格

implementation 'com.google.android.material:material:1.1.0-alpha10'

Litepal数据库

Github地址 https://github.com/LitePalFramework/LitePal

implementation 'org.litepal.android:java:3.0.0'

EventBus3.0

GitHub地址 https://github.com/greenrobot/EventBus

implementation 'org.greenrobot:eventbus:3.1.1'

今日头条屏幕适配方案

GitHub地址 https://github.com/JessYanCoding/AndroidAutoSize

implementation 'me.jessyan:autosize:1.1.2'

智能下拉刷新

GitHub地址 https://github.com/scwang90/SmartRefreshLayout

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-22'
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-22'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

FastJson

GitHub地址 https://github.com/alibaba/fastjson

implementation 'com.alibaba:fastjson:1.2.59'

Android代码发送邮件的库

一个同时支持Kotlin和Java的库,没有服务器的同窗能够使用这个作用户反馈功能。Github地址 https://github.com/teprinciple/MailSender

implementation 'com.teprinciple:mailsender:1.1.0'

Android RecyclerView万能适配器

GitHub地址 https://github.com/CymChad/BaseRecyclerViewAdapterHelper

implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46'

Android仿iOS加载框

Github地址 https://github.com/saiwu-bigkoo/Android-SVProgressHUD

implementation 'com.bigkoo:svprogresshud:1.0.6'

Java-WebSocket

一个使用Java集成WebSocket开发Android IM客户端。GitHub地址https://github.com/TooTallNate/Java-WebSocket

implementation "org.java-websocket:Java-WebSocket:1.4.0"

Glide图片加载框架

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

implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

阿里巴巴Android组件化路由

Github地址 https://github.com/alibaba/ARouter

    implementation 'com.alibaba:arouter-api:1.4.1'
    annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'

但愿个人这篇文章对Android开发的小伙伴们有帮助。推广一下我微信公众号,我会常常更新一下技术干货或者开发踩坑历程,欢迎你们关注我!

相关文章
相关标签/搜索