build.gradle 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-android-extensions'
  4. apply plugin: 'kotlin-kapt'
  5. apply plugin: 'realm-android'
  6. ext {
  7. //定义变量
  8. signingConfigKeyAlias = ""
  9. signingConfigKeyPassword = ""
  10. signingConfigStoreFilePath = ""
  11. signingConfigStorePassword = ""
  12. jpushAppKey = ""
  13. baiduSpeechAppId = ""
  14. baiduSpeechSecret = ""
  15. baiduSpeechAppKey = ""
  16. baiduMapAppKey = ""
  17. jpushIMPassword = ""
  18. xiaomiAppId=""
  19. xiaomiAppKey=""
  20. oppoAppKey=""
  21. oppoAppId=""
  22. oppoAppSecret=""
  23. vivoAppKey=""
  24. vivoAppId=""
  25. }
  26. def loadProperties() {
  27. Properties properties = new Properties()
  28. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  29. // 打包apk使用的密钥文件相关信息,请填写到local.properties文件中
  30. project.signingConfigKeyAlias = properties.getProperty("signingConfig.keyAlias")
  31. project.signingConfigKeyPassword = properties.getProperty("signingConfig.keyPassword")
  32. project.signingConfigStoreFilePath = properties.getProperty("signingConfig.storeFilePath")
  33. project.signingConfigStorePassword = properties.getProperty("signingConfig.storePassword")
  34. //release key
  35. project.jpushAppKey = project.property("JPUSH_APPKEY").toString()
  36. project.baiduSpeechAppId = project.property("BAIDU_SPEECH_APPID").toString()
  37. project.baiduSpeechSecret = project.property("BAIDU_SPEECH_SECRET").toString()
  38. project.baiduSpeechAppKey = project.property("BAIDU_SPEECH_APPKEY").toString()
  39. project.baiduMapAppKey = project.property("BAIDU_MAP_APPKEY").toString()
  40. project.xiaomiAppId=project.property("XIAOMI_APPID").toString()
  41. project.xiaomiAppKey=project.property("XIAOMI_APPKEY").toString()
  42. // project.oppoAppKey=project.property("OPPO_APPKEY").toString()
  43. // project.oppoAppId=project.property("OPPO_APPID").toString()
  44. // project.oppoAppSecret=project.property("OPPO_APPSECRET").toString()
  45. // project.vivoAppKey=project.property("VIVO_APPKEY").toString()
  46. // project.vivoAppId=project.property("VIVO_APPID").toString()
  47. }
  48. loadProperties()
  49. task printVersionName {
  50. def v = project.property("o2.versionName").toString()
  51. println("${v}")
  52. }
  53. android {
  54. compileSdkVersion 31
  55. buildToolsVersion "30.0.3"
  56. sourceSets {
  57. main {
  58. jniLibs.srcDir 'libs'
  59. assets.srcDirs = ['assets']
  60. res.srcDirs = ['src/main/res', 'src/main/res/raw']
  61. }
  62. }
  63. signingConfigs {
  64. release {
  65. v1SigningEnabled true
  66. v2SigningEnabled true
  67. keyAlias project.signingConfigKeyAlias
  68. keyPassword project.signingConfigKeyPassword
  69. storeFile file(project.signingConfigStoreFilePath)
  70. storePassword project.signingConfigStorePassword
  71. }
  72. debug {
  73. v1SigningEnabled true
  74. v2SigningEnabled true
  75. keyAlias project.signingConfigKeyAlias
  76. keyPassword project.signingConfigKeyPassword
  77. storeFile file(project.signingConfigStoreFilePath)
  78. storePassword project.signingConfigStorePassword
  79. // keyAlias 'androiddebugkey'
  80. // storeFile file('debug.keystore')
  81. // keyPassword 'android'
  82. }
  83. }
  84. defaultConfig {
  85. applicationId "com.dccr.oa"
  86. minSdkVersion 21
  87. targetSdkVersion 31
  88. versionCode project.property("o2.versionCode").toInteger()
  89. versionName project.property("o2.versionName").toString()
  90. multiDexEnabled true
  91. ndk {
  92. //选择要添加的对应cpu类型的.so库。
  93. // abiFilters 'armeabi', 'armeabi-v7a'
  94. // abiFilters 'armeabi-v7a', 'arm64-v8a'
  95. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
  96. }
  97. multiDexKeepProguard file('multidex_keep_file.pro')
  98. vectorDrawables.useSupportLibrary = true
  99. dataBinding {
  100. enabled = true
  101. }
  102. }
  103. compileOptions {
  104. sourceCompatibility JavaVersion.VERSION_1_8
  105. targetCompatibility JavaVersion.VERSION_1_8
  106. }
  107. buildTypes {
  108. debug {
  109. signingConfig signingConfigs.release
  110. buildConfigField "Boolean", "InnerServer", "true"
  111. buildConfigField "Boolean", "LOG_ENABLE", "true"
  112. buildConfigField "Boolean", "NEED_UPDATE", "true"
  113. buildConfigField "Boolean", "LOG_FILE", "true"
  114. manifestPlaceholders = [JPUSH_PKGNAME : defaultConfig.applicationId,
  115. JPUSH_APPKEY : project.jpushAppKey,
  116. XIAOMI_APPID : project.xiaomiAppId,
  117. XIAOMI_APPKEY : project.xiaomiAppKey,
  118. BAIDU_SPEECH_APPID : project.baiduSpeechAppId,
  119. BAIDU_SPEECH_SECRET: project.baiduSpeechSecret,
  120. BAIDU_SPEECH_APPKEY: project.baiduSpeechAppKey,
  121. BAIDU_MAP_APPKEY : project.baiduMapAppKey]
  122. zipAlignEnabled true
  123. minifyEnabled true
  124. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  125. }
  126. release {
  127. signingConfig signingConfigs.release
  128. buildConfigField "Boolean", "InnerServer", "true"
  129. buildConfigField "Boolean", "LOG_ENABLE", "false"
  130. buildConfigField "Boolean", "NEED_UPDATE", "true"
  131. buildConfigField "Boolean", "LOG_FILE", "true"
  132. manifestPlaceholders = [JPUSH_PKGNAME : defaultConfig.applicationId,
  133. JPUSH_APPKEY : project.jpushAppKey,
  134. XIAOMI_APPID : project.xiaomiAppId,
  135. XIAOMI_APPKEY : project.xiaomiAppKey,
  136. BAIDU_SPEECH_APPID : project.baiduSpeechAppId,
  137. BAIDU_SPEECH_SECRET: project.baiduSpeechSecret,
  138. BAIDU_SPEECH_APPKEY: project.baiduSpeechAppKey,
  139. BAIDU_MAP_APPKEY : project.baiduMapAppKey]
  140. zipAlignEnabled true
  141. minifyEnabled true
  142. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  143. //apk包重命名
  144. applicationVariants.all { variant ->
  145. variant.outputs.all {
  146. outputFileName = "${variant.productFlavors[0].name}-${variant.versionName}.apk"
  147. }
  148. }
  149. }
  150. }
  151. android {
  152. lintOptions {
  153. abortOnError false
  154. }
  155. }
  156. lintOptions {
  157. checkReleaseBuilds false
  158. abortOnError false
  159. }
  160. flavorDimensions "type"
  161. productFlavors {
  162. O2PLATFORM {
  163. manifestPlaceholders = [JPUSH_CHANNEL: "pgy"]
  164. }
  165. huawei {
  166. manifestPlaceholders = [JPUSH_CHANNEL: "huawei"]
  167. }
  168. xiaomi {
  169. manifestPlaceholders = [JPUSH_CHANNEL: "xiaomi"]
  170. }
  171. }
  172. }
  173. buildscript {
  174. repositories {
  175. mavenCentral()
  176. }
  177. dependencies {
  178. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  179. classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
  180. }
  181. }
  182. repositories {
  183. flatDir {
  184. dirs 'libs'
  185. }
  186. //o2oa
  187. maven { url "../o2_flutter/buildAAR/host/outputs/repo" }
  188. maven {
  189. url 'https://storage.googleapis.com/download.flutter.io'
  190. }
  191. }
  192. dependencies {
  193. // 百度地图
  194. implementation files('libs/BaiduLBS_Android.jar')
  195. // 扫码
  196. implementation 'com.google.zxing:core:3.4.1'
  197. implementation files('libs/pinyin4j-2.5.0.jar')
  198. implementation files('libs/universal-image-loader-1.9.5.jar')
  199. // implementation(name: 'material-calendarview-fancy-1.1', ext: 'aar')
  200. implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1'
  201. implementation 'com.github.prolificinteractive:material-calendarview:2.0.0'
  202. implementation project(path: ':o2_auth_sdk')
  203. // // flutter 相关的aar
  204. // flutter模块开发调试用
  205. // implementation project(':flutter')
  206. // debugImplementation 'io.flutter.plugins.pathprovider:path_provider_android_debug:1.0'
  207. implementation 'io.flutter.plugins.pathprovider:path_provider_android_release:1.0'
  208. // debugImplementation 'io.flutter.plugins.sharedpreferences:shared_preferences_android_debug:1.0'
  209. implementation 'io.flutter.plugins.sharedpreferences:shared_preferences_android_release:1.0'
  210. // debugImplementation 'net.o2oa.app.flutter.o2_flutter:flutter_debug:1.0'
  211. implementation 'net.o2oa.app.flutter.o2_flutter:flutter_release:1.0'
  212. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  213. implementation "org.jetbrains.anko:anko-common:$anko_version"
  214. implementation('androidx.legacy:legacy-support-v4:1.0.0')
  215. implementation('androidx.recyclerview:recyclerview:1.2.1') {
  216. exclude module: 'support-v4'
  217. }
  218. implementation('androidx.appcompat:appcompat:1.2.0')
  219. implementation('androidx.cardview:cardview:1.0.0')
  220. implementation('com.google.android.material:material:1.2.0')
  221. implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
  222. implementation 'androidx.multidex:multidex:2.0.1'
  223. implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
  224. implementation('com.github.bumptech.glide:glide:4.12.0')
  225. implementation 'com.afollestad.material-dialogs:core:0.8.5.9'
  226. implementation(name: 'changeskin-1.3.0', ext: 'aar')
  227. implementation 'io.o2oa:signatureview:1.0.0'
  228. implementation 'com.github.fancylou:CalendarView:v1.2.0'
  229. implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
  230. implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
  231. implementation 'com.borax12.materialdaterangepicker:library:1.9'
  232. implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
  233. implementation 'com.race604.waveloading:library:1.1.1'
  234. implementation 'com.squareup.retrofit2:retrofit:2.4.0'
  235. implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
  236. implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
  237. implementation 'com.squareup.okhttp3:okhttp:3.11.0'
  238. implementation 'io.reactivex:rxjava:1.1.6'
  239. implementation 'io.reactivex:rxandroid:1.2.1'
  240. /////////////////////////////////////////////////推送///////////////////////
  241. implementation project(':jiguang')
  242. implementation 'com.contrarywind:Android-PickerView:4.1.9'
  243. //滚动选择器
  244. implementation 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
  245. //链式方式获取Activity返回结果
  246. implementation 'com.github.lwugang:ActivityResult:59b23e3682'
  247. //google architecture component
  248. // ViewModel and LiveData
  249. implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
  250. // alternatively - just ViewModel
  251. implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
  252. // use -ktx for Kotlin
  253. // alternatively - just LiveData
  254. implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
  255. // Support library depends on this lightweight import
  256. implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
  257. //noinspection LifecycleAnnotationProcessorWithJava8
  258. annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'
  259. implementation 'com.google.code.gson:gson:2.8.5'
  260. //GSYVideo播放器
  261. implementation('com.shuyu:GSYVideoPlayer:8.0.0')
  262. //mp3录音
  263. implementation 'com.github.zhaolewei:ZlwAudioRecorder:v1.07'
  264. //gif 播放
  265. implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
  266. // 图片放大缩小
  267. implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
  268. testImplementation 'junit:junit:4.12'
  269. }
  270. tasks.whenTaskAdded { task ->
  271. if (task.name == "lint") {
  272. task.enabled = false
  273. }
  274. }