build.gradle 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'com.jakewharton.butterknife'
  3. apply plugin: 'kotlin-android'
  4. apply plugin: 'kotlin-android-extensions'
  5. apply plugin: 'kotlin-kapt'
  6. // Create a variable called keystorePropertiesFile, and initialize it to your
  7. // keystore.properties file, in the rootProject folder.
  8. def keystorePropertiesFile = rootProject.file("keystore.properties")
  9. // Initialize a new Properties() object called keystoreProperties.
  10. def keystoreProperties = new Properties()
  11. // Load your keystore.properties file into the keystoreProperties object.
  12. keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  13. // 编译时间
  14. static def buildTime() {
  15. return new Date().format("yyyyMMdd")
  16. }
  17. android {
  18. applicationVariants.all { variant ->
  19. variant.outputs.all {
  20. def time = new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("UTC"))
  21. if (variant.buildType.name == 'release') {
  22. outputFileName = "YouQi_" + "${variant.mergedFlavor.versionName}_release.apk"
  23. } else if (variant.buildType.name == 'debug') {
  24. outputFileName = "YouQi_" + "${variant.mergedFlavor.versionName}_debug.apk"
  25. }
  26. }
  27. }
  28. // 配置 签名
  29. signingConfigs {
  30. config {
  31. keyAlias keystoreProperties['keyAlias']
  32. keyPassword keystoreProperties['keyPassword']
  33. storeFile file(keystoreProperties['storeFile'])
  34. storePassword keystoreProperties['storePassword']
  35. }
  36. debug {
  37. keyAlias keystoreProperties['keyAlias']
  38. keyPassword keystoreProperties['keyPassword']
  39. storeFile file(keystoreProperties['storeFile'])
  40. storePassword keystoreProperties['storePassword']
  41. }
  42. release {
  43. keyAlias keystoreProperties['keyAlias']
  44. keyPassword keystoreProperties['keyPassword']
  45. storeFile file(keystoreProperties['storeFile'])
  46. storePassword keystoreProperties['storePassword']
  47. }
  48. }
  49. // signingConfigs {
  50. // config {
  51. // storeFile file('/Users/mac/Desktop/androidProject/key/youqi.jks')
  52. // storePassword 'jyf_20190830'
  53. // keyAlias = 'jinyunfu'
  54. // keyPassword 'jyf_20190830'
  55. // }
  56. // debug {
  57. // storeFile file('/Users/mac/Desktop/androidProject/key/youqi.jks')
  58. // storePassword 'jyf_20190830'
  59. // keyAlias = 'jinyunfu'
  60. // keyPassword 'jyf_20190830'
  61. // }
  62. // }
  63. compileSdkVersion build_versions.target_sdk
  64. defaultConfig {
  65. applicationId "com.shanp.youqi"
  66. minSdkVersion build_versions.min_sdk
  67. targetSdkVersion build_versions.target_sdk
  68. versionCode build_versions.version_code
  69. versionName build_versions.version_name
  70. multiDexEnabled true//打包时间
  71. resValue "string", "build_time", buildTime()
  72. ndk {
  73. //设置支持的SO库架构
  74. abiFilters "armeabi-v7a", 'arm64-v8a'
  75. }
  76. javaCompileOptions {
  77. annotationProcessorOptions {
  78. arguments = [AROUTER_MODULE_NAME: project.getName()]
  79. }
  80. }
  81. }
  82. compileOptions {
  83. sourceCompatibility JavaVersion.VERSION_1_8
  84. targetCompatibility JavaVersion.VERSION_1_8
  85. }
  86. buildTypes {
  87. release {
  88. minifyEnabled true
  89. zipAlignEnabled true
  90. shrinkResources true
  91. signingConfig signingConfigs.config
  92. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  93. buildConfigField("String", "SERVER", "\"https://logic.uqchat.cn\"")
  94. buildConfigField("String", "SERVER_ROOM_HOST", "\"chat.uqchat.cn\"")
  95. manifestPlaceholders = [RONG_CLOUD_APP_KEY: "n19jmcy5na779"]
  96. }
  97. debug {
  98. //给applicationId添加后缀“.debug”
  99. // applicationIdSuffix ".debug"
  100. //manifestPlaceholders = [app_icon: "@load/launch_beta"]
  101. signingConfig signingConfigs.debug
  102. buildConfigField "boolean", "LOG_DEBUG", "true"
  103. // buildConfigField("String", "SERVER", "\"http://192.168.2.91:8080\"")
  104. // buildConfigField("String", "SERVER", "\"http://192.168.2.68:8080\"")
  105. // buildConfigField("String", "SERVER", "\"https://logic.test.uqchat.cn\"")
  106. buildConfigField("String", "SERVER", "\"https://logic.test.uqchat.cn\"")
  107. buildConfigField("String", "SERVER_ROOM_HOST", "\"chat.test.uqchat.cn\"")
  108. manifestPlaceholders = [RONG_CLOUD_APP_KEY: "p5tvi9dspe334"]
  109. }
  110. }
  111. useLibrary 'org.apache.http.legacy'
  112. buildFeatures {
  113. dataBinding = true
  114. viewBinding = true
  115. }
  116. }
  117. dependencies {
  118. implementation fileTree(include: ['*.jar'], dir: 'libs')
  119. implementation deps.support.multidex
  120. implementation deps.constraint_layout
  121. annotationProcessor deps.arouter_compiler
  122. kapt deps.arouter_compiler
  123. annotationProcessor deps.butterknife_annotationProcessor
  124. kapt deps.butterknife_annotationProcessor
  125. api project(':uchat_common')
  126. if (!isModule.toBoolean()) {
  127. implementation project(':uchat_account')
  128. implementation project(':uchat_user')
  129. implementation project(':uchat_im')
  130. implementation project(':uchat_room')
  131. implementation project(':uchat_plaza')
  132. implementation project(':uchat_topic')
  133. implementation project(':uchat_wallet')
  134. implementation project(':uchat_show')
  135. implementation project(':uchat_play')
  136. implementation project(':uchat_club')
  137. }
  138. debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
  139. releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
  140. }