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開發的小夥伴們有幫助。推廣一下我微信公衆號,我會常常更新一下技術乾貨或者開發踩坑歷程,歡迎你們關注我!

相關文章
相關標籤/搜索