dependencies.gradle 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. //配置各个module共用的参数
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-android-extensions'
  4. apply plugin: 'kotlin-kapt'//kotlin语言使用注入框架,dataBinding都需要这个
  5. apply plugin: 'androidx.navigation.safeargs.kotlin'//用于navigation传参的时候一种安全防护,非空,类型判断等。
  6. android {
  7. compileSdkVersion compile_sdk_version
  8. buildToolsVersion build_tools_version
  9. defaultConfig {
  10. minSdkVersion min_sdk_verion
  11. targetSdkVersion target_sdk_version
  12. versionCode lib_version_code
  13. versionName lib_version_name
  14. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  15. consumerProguardFiles 'consumer-rules.pro'
  16. //Java中的配置 生成schema文件,便于查看数据库创建表的详细信息
  17. javaCompileOptions {
  18. annotationProcessorOptions {
  19. //room 的scheme
  20. arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
  21. // ARouter的需要配置
  22. arguments = [AROUTER_MODULE_NAME: project.getName()]
  23. }
  24. }
  25. //kotlin ARouter 的配置方式
  26. kapt {
  27. arguments {
  28. arg("AROUTER_MODULE_NAME", project.getName())
  29. arg("room.schemaLocation": "$projectDir/schemas".toString())
  30. }
  31. }
  32. ndk {
  33. //选择要添加的对应 cpu 类型的 .so 库。
  34. abiFilters 'armeabi-v7a', 'arm64-v8a'
  35. // 还可以添加 'armeabi','x86', 'x86_64', 'mips', 'mips64'
  36. }
  37. // dex突破65535的限制
  38. multiDexEnabled true
  39. }
  40. buildTypes {
  41. release {
  42. minifyEnabled false
  43. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  44. }
  45. }
  46. //AndroidStudio 4 以下使用这种方式配置dataBinding
  47. // dataBinding {
  48. // isEnabled = true
  49. // }
  50. //AS4 以上版本使用这个配置dataBinding
  51. buildFeatures {
  52. dataBinding = true
  53. viewBinding = true
  54. }
  55. compileOptions {
  56. sourceCompatibility = 1.8
  57. targetCompatibility = 1.8
  58. }
  59. //使用jetPack的组件,会要求jdk 1.8最好,有的时候会遇到报错,需要配置如下,避免target jvm 1.8的那个报错
  60. kotlinOptions {
  61. jvmTarget = "1.8"
  62. // freeCompilerArgs += ["-Xuse-experimental=kotlin.contracts.ExperimentalContracts",]
  63. freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn",]
  64. }
  65. }
  66. dependencies {
  67. implementation fileTree(include: ['*.jar'], dir: 'libs')
  68. //region 平台相关的基础库
  69. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
  70. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
  71. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
  72. implementation 'androidx.appcompat:appcompat:1.2.0'
  73. implementation 'androidx.core:core-ktx:1.3.2'
  74. implementation 'androidx.fragment:fragment-ktx:1.2.5'
  75. implementation 'androidx.activity:activity-ktx:1.1.0'
  76. implementation "androidx.constraintlayout:constraintlayout:2.0.4"
  77. implementation 'androidx.recyclerview:recyclerview:1.1.0'
  78. implementation 'com.google.android.material:material:1.2.1'
  79. implementation "androidx.viewpager2:viewpager2:1.0.0"
  80. implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
  81. // dataBinding和viewBinding消除模版代码的库
  82. implementation 'com.hi-dhl:binding:1.0.7'
  83. //endregion
  84. //region 优秀第三方必备框架库
  85. // 多级联动 选择
  86. implementation 'com.contrarywind:Android-PickerView:4.1.9'
  87. // 多级联动 选择
  88. implementation 'com.contrarywind:wheelview:4.1.0'
  89. // 状态栏 基础依赖包,必须要依赖
  90. implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
  91. // // 图片裁剪
  92. // implementation 'com.github.yalantis:ucrop:2.2.6'
  93. // 输入验证码view
  94. implementation 'com.xw.repo:fillblankview:2.3'
  95. // 2、下载框架
  96. implementation 'com.liulishuo.filedownloader:library:1.7.7'
  97. // QMUI
  98. implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
  99. // 圆形 ImageView
  100. implementation "de.hdodenhof:circleimageview:2.2.0"
  101. // json 动画
  102. implementation "com.airbnb.android:lottie:3.4.0"
  103. // RecyclerViewAdapter
  104. implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
  105. // 刷新加载视图
  106. implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' //核心必须依赖
  107. implementation 'com.scwang.smart:refresh-header-classics:2.0.1' //经典刷新头
  108. implementation 'com.scwang.smart:refresh-header-material:2.0.3' //谷歌刷新头
  109. // OSS
  110. api "com.aliyun.dpa:oss-android-sdk:2.9.3"
  111. //ARouter
  112. implementation 'com.alibaba:arouter-api:1.5.0'
  113. kapt 'com.alibaba:arouter-compiler:1.5.1'
  114. //liveData eventBus
  115. implementation 'com.jeremyliao:live-event-bus-x:1.7.2'
  116. //endregion
  117. // region Koin for Kotlin
  118. implementation "org.koin:koin-core:$koin_version"
  119. implementation "org.koin:koin-core-ext:$koin_version"
  120. // Koin for AndroidX
  121. implementation "org.koin:koin-androidx-scope:$koin_version"
  122. implementation "org.koin:koin-androidx-viewmodel:$koin_version"
  123. implementation "org.koin:koin-androidx-fragment:$koin_version"
  124. implementation "org.koin:koin-androidx-ext:$koin_version"
  125. testImplementation "org.koin:koin-test:$koin_version"
  126. // endregion
  127. //region jetPack libs
  128. // implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'//已经废弃
  129. implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
  130. implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
  131. implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
  132. implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
  133. implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
  134. kapt "androidx.lifecycle:lifecycle-common-java8:2.2.0"
  135. implementation 'androidx.room:room-runtime:2.2.5'
  136. implementation 'androidx.room:room-common:2.2.5'
  137. implementation 'androidx.room:room-ktx:2.2.5'
  138. kapt "androidx.room:room-compiler:2.2.5"
  139. implementation 'androidx.paging:paging-runtime:3.0.0-alpha10'
  140. implementation 'androidx.paging:paging-common:3.0.0-alpha10'
  141. implementation 'androidx.work:work-runtime:2.4.0'
  142. implementation 'androidx.work:work-runtime-ktx:2.4.0'
  143. //注意配置navigation版本号的时候,project下的build.gradle的class path也需要同步navigation的版本号配置
  144. implementation "androidx.navigation:navigation-ui:$navigation_version"
  145. implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
  146. implementation "androidx.navigation:navigation-fragment:$navigation_version"
  147. implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
  148. implementation "androidx.navigation:navigation-runtime:$navigation_version"
  149. // CameraX 核心库使用 camera2 实现
  150. implementation "androidx.camera:camera-camera2:1.0.0-beta07"
  151. // 可以使用CameraView
  152. implementation "androidx.camera:camera-view:1.0.0-alpha14"
  153. // 可以使用供应商扩展
  154. implementation "androidx.camera:camera-extensions:1.0.0-alpha14"
  155. //camerax的生命周期库
  156. implementation "androidx.camera:camera-lifecycle:1.0.0-beta07"
  157. //endregion
  158. //region test libs
  159. testImplementation 'junit:junit:4.13'
  160. androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  161. androidTestImplementation 'androidx.test:core:1.3.0'
  162. androidTestImplementation 'androidx.test:core-ktx:1.2.0'
  163. androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  164. //endregion
  165. }