build.gradle 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. plugins {
  2. id 'com.android.application'
  3. id 'kotlin-android'
  4. id 'kotlin-android-extensions'
  5. }
  6. android {
  7. compileSdkVersion rootProject.ext.android["compileSdkVersion"]
  8. buildToolsVersion rootProject.ext.android["buildToolsVersion"]
  9. defaultConfig {
  10. applicationId rootProject.ext.android["applicationId"]
  11. minSdkVersion rootProject.ext.android["minSdkVersion"]
  12. targetSdkVersion rootProject.ext.android["targetSdkVersion"]
  13. versionCode rootProject.ext.android["versionCode"]
  14. versionName rootProject.ext.android["versionName"]
  15. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  16. flavorDimensions "versionCode"
  17. }
  18. signingConfigs {
  19. debug {
  20. storeFile file('./src/main/jks/hh-face.jks')
  21. storePassword 'Nqj##117521'
  22. keyAlias 'hemile'
  23. keyPassword 'Nqj##117521'
  24. }
  25. release {
  26. storeFile file('./src/main/jks/hh-face.jks')
  27. storePassword 'Nqj##117521'
  28. keyAlias 'hemile'
  29. keyPassword 'Nqj##117521'
  30. }
  31. }
  32. buildTypes {
  33. release {
  34. // 服务器地址
  35. // 通用
  36. buildConfigField("String", "BASE_URL", "\"https://hhomc.hz-hanghui.com:8096/\"")
  37. buildConfigField("String", "BASE_URL_WEBSOCKET", "\"wss://hhomc.hz-hanghui.com:18096/\"")
  38. // 故宫
  39. // buildConfigField("String", "BASE_URL", "\"https://aiotota.dpm.org.cn/\"")
  40. // buildConfigField("String", "BASE_URL_WEBSOCKET", "\"wss://aiotota.dpm.org.cn/\"")
  41. buildConfigField("String", "BASE_API_URL", "\"\"")
  42. // buildConfigField("String", "LOG_FILE_AROME", "\"/storage/emulated/0/Android/data/com.hh.arome/files\"")
  43. // buildConfigField("String", "PACKAGE_NAME_AROME", "\"com.hh.arome\"")
  44. resValue "string", "app_name", "HHOMC"
  45. signingConfig signingConfigs.release
  46. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  47. shrinkResources false
  48. minifyEnabled false
  49. zipAlignEnabled true
  50. debuggable true
  51. jniDebuggable true
  52. testCoverageEnabled false
  53. // 3.0后的配置
  54. applicationVariants.all { variant ->
  55. variant.outputs.all { output ->
  56. def outputFile = output.outputFile
  57. if (outputFile != null && outputFile.name.endsWith('.apk')) {
  58. // 输出apk名称为jjb_v1.0_wandoujia.apk
  59. def fileName_new = "hhomc_v${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
  60. outputFileName = fileName_new
  61. }
  62. }
  63. }
  64. }
  65. yufabu {
  66. applicationIdSuffix ".yufabu"
  67. buildConfigField("String", "BASE_URL", "\"http://192.168.11.9:9086/\"")
  68. buildConfigField("String", "BASE_URL_WEBSOCKET", "\"ws://192.168.11.9:19086/\"")
  69. buildConfigField("String", "BASE_API_URL", "\"\"")
  70. // buildConfigField("String", "LOG_FILE_AROME", "\"/storage/emulated/0/Android/data/com.hh.arome.yufabu/files\"")
  71. // buildConfigField("String", "PACKAGE_NAME_AROME", "\"com.hh.arome.yufabu\"")
  72. // 测试的IM信息
  73. // buildConfigField("int", "TIM_SDKAPPID", "1400803088")
  74. // buildConfigField("String", "TIM_SECRETKEY", "\"f942e1545dd5465c6d54fe68d2c42d9af424a2e7f3ed84133bc2f7b40191b271\"")
  75. resValue "string", "app_name", "测试HHOMC"
  76. minifyEnabled false
  77. shrinkResources false
  78. jniDebuggable true
  79. debuggable true
  80. signingConfig signingConfigs.release
  81. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  82. }
  83. debug {
  84. applicationIdSuffix ".test"
  85. buildConfigField("String", "BASE_URL", "\"http://192.168.11.9:9086/\"")
  86. buildConfigField("String", "BASE_URL_WEBSOCKET", "\"ws://192.168.11.9:19086/\"")
  87. buildConfigField("String", "BASE_API_URL", "\"\"")
  88. // buildConfigField("String", "LOG_FILE_AROME", "\"/storage/emulated/0/Android/data/com.hh.arome.test/files\"")
  89. // buildConfigField("String", "PACKAGE_NAME_AROME", "\"com.hh.arome.test\"")
  90. resValue "string", "app_name", "开发HHOMC"
  91. minifyEnabled false
  92. shrinkResources false
  93. jniDebuggable true
  94. debuggable true
  95. signingConfig signingConfigs.release
  96. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  97. }
  98. }
  99. // 与buildTypes中输出签名后的apk对应
  100. productFlavors {
  101. app {}
  102. }
  103. productFlavors.all {
  104. flavor -> flavor.manifestPlaceholders = [CHANNEL_VALUE: name]
  105. }
  106. dexOptions {
  107. javaMaxHeapSize "4g"
  108. }
  109. repositories {
  110. flatDir {
  111. dirs 'libs'
  112. }
  113. }
  114. sourceSets {
  115. main {
  116. jniLibs.srcDirs = ['libs']
  117. }
  118. }
  119. compileOptions {
  120. sourceCompatibility JavaVersion.VERSION_1_8
  121. targetCompatibility JavaVersion.VERSION_1_8
  122. }
  123. }
  124. dependencies {
  125. implementation 'androidx.appcompat:appcompat:1.1.0'
  126. implementation 'com.google.android.material:material:1.1.0'
  127. implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
  128. testImplementation 'junit:junit:4.+'
  129. androidTestImplementation 'androidx.test.ext:junit:1.1.1'
  130. androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  131. // 添加base依赖
  132. implementation project(path: ':lib_base')
  133. // 重启设备
  134. implementation files('libs/PosUtil.jar')
  135. implementation 'com.neovisionaries:nv-websocket-client:2.2'
  136. implementation 'org.java-websocket:Java-WebSocket:1.3.7'
  137. implementation 'com.google.code.gson:gson:2.8.8'
  138. // okHttp
  139. // implementation 'com.squareup.okhttp3:okhttp:3.4.1'
  140. // implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
  141. // 断点下载
  142. implementation 'com.yaoxiaowen:download:1.4.1'
  143. // implementation project(path: ':downloaderHelper')
  144. implementation 'com.alibaba:fastjson:1.2.76'
  145. implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
  146. }