build.gradle 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import java.text.SimpleDateFormat
  2. import java.time.LocalDateTime
  3. plugins {
  4. id 'com.android.application'
  5. id 'kotlin-android'
  6. id 'kotlin-kapt'
  7. }
  8. static int formatTime() {
  9. LocalDateTime now = LocalDateTime.now()
  10. int year = now.year % 100 // 取年份的最后两位
  11. int month = now.monthValue
  12. int day = now.dayOfMonth
  13. int hour = now.hour
  14. int randomNumber = new Random().nextInt(10) // 生成0到9之间的随机数
  15. return Integer.parseInt(String.format("%02d%02d%02d%02d%d", year, month, day, hour, randomNumber))
  16. }
  17. ext{
  18. versionCode=Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1)
  19. brandCode="000A"
  20. brandVersionCode=versionCode
  21. model="3015"
  22. }
  23. android {
  24. compileSdk 31
  25. defaultConfig {
  26. applicationId "com.develop.foodcooking"
  27. minSdk 21
  28. targetSdk 26
  29. versionCode project.ext.versionCode
  30. versionName "${project.ext.model}.${project.ext.brandCode}.${project.ext.versionCode}"
  31. archivesBaseName = "cofar-cooking_${versionName}"
  32. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  33. javaCompileOptions {
  34. annotationProcessorOptions {
  35. arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
  36. }
  37. }
  38. kapt {
  39. arguments {
  40. arg("AROUTER_MODULE_NAME", project.getName())
  41. arg("room.schemaLocation", "$projectDir/schemas".toString())
  42. }
  43. }
  44. packagingOptions {
  45. pickFirst 'lib/armeabi-v7a/libc++_shared.so'
  46. }
  47. }
  48. flavorDimensions "platform"
  49. productFlavors {
  50. brandDefault {
  51. dimension "platform"
  52. applicationId "com.develop.foodcooking"
  53. buildConfigField("String", "UpdatePlatform", "\"normal\"")
  54. resValue("string", "app_theme", "@style/SplashTheme")
  55. }
  56. brand000ATuya {
  57. dimension "platform"
  58. applicationId "com.develop.foodcooking"
  59. buildConfigField("String", "UpdatePlatform", "\"night\"")
  60. resValue("string", "app_theme", "@style/SplashTheme")
  61. }
  62. brand034 {
  63. dimension "platform"
  64. applicationId "com.develop.foodcooking"
  65. buildConfigField("String", "UpdatePlatform", "\"night\"")
  66. resValue("string", "app_theme", "@style/Splash034Theme")
  67. }
  68. }
  69. signingConfigs {
  70. debug {
  71. storeFile file('..\\signature\\rk.jks')
  72. storePassword '123456'
  73. keyAlias 'rk'
  74. keyPassword '123456'
  75. }
  76. foodCooking {
  77. storeFile file("..\\signature\\rk.jks")
  78. storePassword '123456'
  79. keyAlias 'rk'
  80. keyPassword '123456'
  81. }
  82. release {
  83. storeFile file('..\\signature\\rk.jks')
  84. storePassword '123456'
  85. keyAlias 'rk'
  86. keyPassword '123456'
  87. }
  88. }
  89. buildTypes {
  90. release {
  91. minifyEnabled false
  92. productFlavors.brand034.signingConfig signingConfigs.release
  93. productFlavors.brandDefault.signingConfig signingConfigs.release
  94. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  95. }
  96. }
  97. compileOptions {
  98. sourceCompatibility JavaVersion.VERSION_1_8
  99. targetCompatibility JavaVersion.VERSION_1_8
  100. }
  101. kotlinOptions {
  102. jvmTarget = '1.8'
  103. }
  104. viewBinding {
  105. enabled = true
  106. }
  107. }
  108. dependencies {
  109. implementation project(path: ':libBase')
  110. implementation project(path: ':BusinessRouter')
  111. implementation project(path: ':BusinessAuth')
  112. implementation project(path: ':BusinessSetting')
  113. implementation project(path: ':BusinessMain')
  114. implementation project(path: ':BusinessStep')
  115. kapt 'com.alibaba:arouter-compiler:1.5.1'
  116. }