dependencies.gradle 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. buildFeatures {
  47. dataBinding = true
  48. viewBinding = true
  49. }
  50. compileOptions {
  51. sourceCompatibility = 1.8
  52. targetCompatibility = 1.8
  53. }
  54. //使用jetPack的组件,会要求jdk 1.8最好,有的时候会遇到报错,需要配置如下,避免target jvm 1.8的那个报错
  55. kotlinOptions {
  56. jvmTarget = "1.8"
  57. // freeCompilerArgs += ["-Xuse-experimental=kotlin.contracts.ExperimentalContracts",]
  58. freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn",]
  59. }
  60. }
  61. dependencies {
  62. implementation fileTree(include: ['*.jar'], dir: 'libs')
  63. //region 平台相关的基础库
  64. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
  65. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
  66. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
  67. implementation 'androidx.appcompat:appcompat:1.2.0'
  68. implementation 'androidx.core:core-ktx:1.3.2'
  69. implementation 'androidx.fragment:fragment-ktx:1.2.5'
  70. implementation 'androidx.activity:activity-ktx:1.1.0'
  71. implementation "androidx.constraintlayout:constraintlayout:2.0.4"
  72. implementation 'androidx.recyclerview:recyclerview:1.1.0'
  73. implementation 'com.google.android.material:material:1.2.1'
  74. implementation "androidx.viewpager2:viewpager2:1.0.0"
  75. implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
  76. implementation "com.android.support:multidex:1.0.3"
  77. // dataBinding和viewBinding消除模版代码的库
  78. implementation 'com.hi-dhl:binding:1.0.7'
  79. //endregion
  80. //region 第三方框架库
  81. implementation 'com.contrarywind:Android-PickerView:4.1.9' // 多级联动 选择
  82. implementation 'com.contrarywind:wheelview:4.1.0' // 滚轮选择
  83. implementation 'com.gyf.immersionbar:immersionbar:3.0.0' // 状态栏 基础依赖包,必须要依赖
  84. // implementation 'com.github.yalantis:ucrop:2.2.6' // 图片裁剪
  85. implementation 'com.xw.repo:fillblankview:2.3' // 输入验证码view
  86. implementation 'com.liulishuo.filedownloader:library:1.7.7' // 下载框架
  87. implementation 'com.qmuiteam:qmui:2.0.0-alpha10' // QMUI
  88. implementation "de.hdodenhof:circleimageview:2.2.0" // 圆形 ImageView
  89. implementation "com.airbnb.android:lottie:3.4.0" // json 动画
  90. implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4' // RecyclerViewAdapter
  91. implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' // 刷新加载视图 核心必须依赖
  92. implementation 'com.scwang.smart:refresh-header-classics:2.0.1' // 刷新加载视图 经典刷新头
  93. implementation 'com.scwang.smart:refresh-header-material:2.0.3' // 刷新加载视图 谷歌刷新头
  94. implementation 'com.alibaba:arouter-api:1.5.0' // ARouter
  95. kapt 'com.alibaba:arouter-compiler:1.5.1' // ARouter
  96. api "com.aliyun.dpa:oss-android-sdk:2.9.3" // OSS
  97. implementation 'com.jeremyliao:live-event-bus-x:1.7.2' //liveData eventBus
  98. implementation 'io.reactivex.rxjava2:rxjava:2.2.14'
  99. implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
  100. //endregion
  101. //region jetPack
  102. implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
  103. implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
  104. implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
  105. implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
  106. implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
  107. implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
  108. kapt "androidx.lifecycle:lifecycle-common-java8:2.2.0"
  109. implementation 'androidx.room:room-runtime:2.2.5'
  110. implementation 'androidx.room:room-common:2.2.5'
  111. implementation 'androidx.room:room-ktx:2.2.5'
  112. kapt "androidx.room:room-compiler:2.2.5"
  113. implementation 'androidx.paging:paging-runtime:3.0.0-alpha10'
  114. implementation 'androidx.paging:paging-common:3.0.0-alpha10'
  115. implementation 'androidx.work:work-runtime:2.4.0'
  116. implementation 'androidx.work:work-runtime-ktx:2.4.0'
  117. //注意配置navigation版本号的时候,project下的build.gradle的class path也需要同步navigation的版本号配置
  118. implementation "androidx.navigation:navigation-ui:$navigation_version"
  119. implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
  120. implementation "androidx.navigation:navigation-fragment:$navigation_version"
  121. implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
  122. implementation "androidx.navigation:navigation-runtime:$navigation_version"
  123. implementation "androidx.camera:camera-camera2:1.0.0-beta07" // CameraX 核心库使用 camera2 实现
  124. implementation "androidx.camera:camera-view:1.0.0-alpha14" // 可以使用CameraView
  125. implementation "androidx.camera:camera-extensions:1.0.0-alpha14" // 可以使用供应商扩展
  126. implementation "androidx.camera:camera-lifecycle:1.0.0-beta07" //camerax的生命周期库
  127. //endregion
  128. //region test libs
  129. testImplementation 'junit:junit:4.13'
  130. androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  131. androidTestImplementation 'androidx.test:core:1.3.0'
  132. androidTestImplementation 'androidx.test:core-ktx:1.2.0'
  133. androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  134. //endregion
  135. }