Android開發常用的依賴和外掛
阿新 • • 發佈:2018-12-08
依賴
//image-loader依賴 implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' //tablayout依賴 implementation 'com.android.support:design:28.+' //圓角依賴 compile 'de.hdodenhof:circleimageview:2.1.0' //banner 輪播圖 compile 'cn.bingoogolapple:bga-banner:[email protected]' //okhttp implementation 'com.squareup.okhttp3:okhttp:3.2.0' //解決okhttp和picasso衝突 implementation 'com.squareup.okio:okio:1.7.0' //動態獲取定位許可權 implementation 'com.yanzhenjie:permission:2.0.0-rc4' //RecylerView implementation 'com.android.support:recyclerview-v7:28.0.0' //fresco 圖片依賴 新版本 implementation 'com.facebook.fresco:fresco:1.11.0' //fresco GIF依賴 新版本 implementation 'com.facebook.fresco:animated-gif:1.11.0' //EventBus 傳值 implementation 'org.greenrobot:eventbus:3.1.1' //butterknife 依賴 需要複製個別外掛 implementation 'com.jakewharton:butterknife:9.0.0-rc1' annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1' //Retrofit 網路請求 implementation 'com.squareup.retrofit2:retrofit:2.4.0' //=============================RxJava+Retrofit============================ implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' //版本要是出錯 就改這個 minSdkVersion 18 targetSdkVersion 22 =========================不報錯這個不用看========================================================= 第三方依賴說明:比如如果依賴了tablayout報錯,首先檢視我們在app下的build檔案下compileSdkVersion版本號 比如版本是26,我們就在就在後面加個26+ implementation 'com.android.support:design:26.+' =====================================================================================================
需要的外掛
//====================================二維碼 Zxing外掛============================= classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' //============================xrecyleview 整個專案的build下========================= classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' //===============================ButterKnife============================= ---------------在app裡的build 最上面--------------------- apply plugin: 'com.jakewharton.butterknife' ----------------在app裡的build 加入依賴--------------------------- implementation 'com.jakewharton:butterknife:9.0.0-rc1' annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1' ------------- 在專案裡的build dependencies的括號里加入外掛--------- classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc1' //==============================greendao================================= 專案下 -----------在repositories的括號里加入倉庫---- mavenCentral() ------------- 在dependencies的括號里加入外掛--------- classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' ---------------在app裡的build最上面--------------------- apply plugin: 'org.greenrobot.greendao' ----------------app裡的build加依賴---------------------- implementation 'org.greenrobot:greendao:3.2.2' ----------------在dependencies的上面-----------包名改了!!!去清單檔案裡複製 greendao { schemaVersion 1 //版本 daoPackage '包名.greendao' // 一般為app包名+生成檔案的資料夾名 targetGenDir 'src/main/java' //生成檔案路徑 } //=============================RxJava+Retrofit============================ app 加依賴 implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'