在平常的Android開發確定少不了Android的build.gradle
文件配置,下面是我收集經常使用的依賴配置,每一個月會更新一次。java
JDK環境:JDK1.8。
編譯器:Android Studio3.0以上。react
大部分依賴都要支持Java8。android
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
如今Android開發項目,大部分建立都是默認支持AndroidX。git
implementation 'androidx.appcompat:appcompat:1.1.0'
如今Android開發大部分都使用約束佈局。github
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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'
GitHub地址 https://github.com/square/okhttp數據庫
implementation 'com.squareup.okhttp3:okhttp:4.1.1'
implementation 'com.squareup.okio:okio:2.2.2'
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'
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'
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"
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'
implementation 'com.google.android.material:material:1.1.0-alpha10'
Github地址 https://github.com/LitePalFramework/LitePal
implementation 'org.litepal.android:java:3.0.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'
GitHub地址 https://github.com/alibaba/fastjson
implementation 'com.alibaba:fastjson:1.2.59'
一個同時支持Kotlin和Java的庫,沒有服務器的同窗能夠使用這個作用戶反饋功能。Github地址 https://github.com/teprinciple/MailSender
implementation 'com.teprinciple:mailsender:1.1.0'
GitHub地址 https://github.com/CymChad/BaseRecyclerViewAdapterHelper
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46'
Github地址 https://github.com/saiwu-bigkoo/Android-SVProgressHUD
implementation 'com.bigkoo:svprogresshud:1.0.6'
一個使用Java集成WebSocket開發Android IM客戶端。GitHub地址https://github.com/TooTallNate/Java-WebSocket
implementation "org.java-websocket:Java-WebSocket:1.4.0"
GitHub地址 https://github.com/bumptech/glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
Github地址 https://github.com/alibaba/ARouter
implementation 'com.alibaba:arouter-api:1.4.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'
但願個人這篇文章對Android開發的小夥伴們有幫助。推廣一下我微信公衆號,我會常常更新一下技術乾貨或者開發踩坑歷程,歡迎你們關注我!