lib_base_config.gradle 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. apply plugin: 'dagger.hilt.android.plugin'
  2. //基类的gradle配置
  3. kapt { //ARouter的编译配置
  4. arguments {
  5. arg("AROUTER_MODULE_NAME", project.getName())
  6. }
  7. }
  8. android {
  9. compileSdk versions.compileSdk
  10. defaultConfig {
  11. minSdk versions.minSdk
  12. targetSdk versions.targetSdk
  13. versionCode 1
  14. versionName "1.0"
  15. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  16. consumerProguardFiles 'consumer-rules.pro'
  17. multiDexEnabled true
  18. vectorDrawables.useSupportLibrary = true
  19. javaCompileOptions { //Hilt的编译配置
  20. annotationProcessorOptions {
  21. arguments += ["foo": "bar"]
  22. }
  23. }
  24. }
  25. buildTypes {
  26. release {
  27. minifyEnabled false
  28. multiDexKeepProguard file('multidex-config.pro')
  29. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  30. }
  31. debug {
  32. multiDexKeepProguard file('multidex-config.pro')
  33. }
  34. }
  35. compileOptions {
  36. sourceCompatibility JavaVersion.VERSION_1_8
  37. targetCompatibility JavaVersion.VERSION_1_8
  38. }
  39. kotlinOptions {
  40. freeCompilerArgs = ['-Xjvm-default=enable']
  41. jvmTarget = JavaVersion.VERSION_1_8
  42. useIR = true
  43. }
  44. lintOptions {
  45. checkReleaseBuilds false
  46. }
  47. packagingOptions {
  48. resources {
  49. excludes += '/META-INF/{AL2.0,LGPL2.1}'
  50. }
  51. }
  52. }
  53. configurations.all {
  54. resolutionStrategy.force 'androidx.multidex:multidex:2.0.1'
  55. resolutionStrategy.force 'androidx.annotation:annotation:1.2.0'
  56. resolutionStrategy.force 'androidx.transition:transition:1.3.1'
  57. resolutionStrategy.force 'androidx.lifecycle:lifecycle-common:2.3.1'
  58. resolutionStrategy.force 'androidx.recyclerview:recyclerview:1.2.0'
  59. }
  60. //ARouter和Hilt的配置都写在了最底层
  61. dependencies {
  62. api fileTree(dir: 'libs', include: ['*.jar'])
  63. //每个模块都要实现的依赖
  64. //Test
  65. testImplementation deps.android.junit
  66. androidTestImplementation deps.android.test_junit
  67. androidTestImplementation deps.android.test_espresso
  68. //依赖注入
  69. implementation deps.support.hilt
  70. kapt deps.support.hilt_kapt
  71. //ARouter路由
  72. implementation(deps.support.arouter) {
  73. exclude group: 'com.android.support'
  74. exclude group: 'androidx.appcompat'
  75. exclude group: 'com.google.android.material'
  76. exclude group: 'androidx.activity'
  77. }
  78. //ARouter的注解处理器
  79. kapt deps.support.arouter_kapt
  80. }