build.gradle 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. plugins {
  2. id 'com.android.application'
  3. }
  4. android {
  5. compileSdk 31
  6. defaultConfig {
  7. applicationId "com.wisewoods.eduandroid"
  8. minSdk 24
  9. targetSdk 28
  10. versionCode getMyAppVersionCode()
  11. versionName getMyAppVersionName()
  12. multiDexEnabled true
  13. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  14. buildFeatures {
  15. viewBinding = true
  16. }
  17. ndk {
  18. abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
  19. }
  20. manifestPlaceholders = [
  21. XG_ACCESS_ID : "1500026199",
  22. XG_ACCESS_KEY: "A2IFX1S0GQVY",
  23. ]
  24. }
  25. buildTypes {
  26. release {
  27. minifyEnabled false
  28. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  29. }
  30. }
  31. // 设置发布版的签名
  32. signingConfigs {
  33. debug {
  34. storeFile file('./eduandroid.jks')
  35. keyAlias 'eduandroid'
  36. storePassword 'eduandroid'
  37. keyPassword 'eduandroid'
  38. }
  39. }
  40. compileOptions {
  41. sourceCompatibility JavaVersion.VERSION_1_8
  42. targetCompatibility JavaVersion.VERSION_1_8
  43. }
  44. packagingOptions {
  45. pickFirst '**/libc++_shared.so'
  46. doNotStrip "*/armeabi/libYTCommon.so"
  47. doNotStrip "*/armeabi-v7a/libYTCommon.so"
  48. doNotStrip "*/x86/libYTCommon.so"
  49. doNotStrip "*/arm64-v8a/libYTCommon.so"
  50. }
  51. }
  52. dependencies {
  53. implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
  54. implementation project(path: ':base')
  55. implementation project(path: ':meeting')
  56. implementation project(path: ':live')
  57. implementation 'androidx.camera:camera-camera2:1.1.0-beta02'
  58. implementation 'androidx.camera:camera-lifecycle:1.1.0-beta02'
  59. implementation 'androidx.camera:camera-view:1.1.0-beta02'
  60. implementation 'androidx.camera:camera-core:1.1.0-beta02'
  61. implementation 'com.github.azhon:AppUpdate:3.0.5'
  62. implementation 'com.qcloud.cos:cos-android:5.7.3'
  63. implementation 'com.tencent.tpns:tpns:1.2.7.1-release'
  64. implementation 'com.pgyer:analytics:4.2.0'
  65. implementation 'xyz.doikki.android.dkplayer:dkplayer-java:3.3.5'
  66. implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.5'
  67. implementation 'xyz.doikki.android.dkplayer:videocache:3.3.5'
  68. implementation 'com.google.android.flexbox:flexbox:3.0.0'
  69. testImplementation 'junit:junit:4.13.2'
  70. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  71. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  72. }
  73. task updateVersionCode(){
  74. doFirst{
  75. // 获取 gradle.properties 文件
  76. def gradleProperties = file('../version.properties')
  77. // 读取里面的键值对
  78. def properties = new Properties()
  79. properties.load(new FileInputStream(gradleProperties))
  80. // 获取里面的 APP_VERSION_CODE 进行 +1
  81. def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1
  82. // 重新赋值
  83. properties['APP_VERSION_CODE'] = codeBumped.toString()
  84. // 写入
  85. properties.store(gradleProperties.newWriter(), null)
  86. }
  87. }
  88. project.tasks.whenTaskAdded { Task theTask ->
  89. if (theTask.name == 'assembleRelease' || theTask.name == 'assembleDebug') {
  90. theTask.dependsOn(updateVersionCode)
  91. theTask.mustRunAfter(updateVersionCode) // updateVersionCode在assembleRelease之前执行
  92. }
  93. }
  94. //preBuild.dependsOn(updateVersionCode)
  95. def getMyAppVersionCode() { //获取APP版本号
  96. def gradleProperties = file('../version.properties')
  97. def properties = new Properties()
  98. properties.load(new FileInputStream(gradleProperties))
  99. def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1
  100. return codeBumped as int
  101. }
  102. def getMyAppVersionName() { //获取APP版本号
  103. def gradleProperties = file('../version.properties')
  104. def properties = new Properties()
  105. properties.load(new FileInputStream(gradleProperties))
  106. def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1
  107. return "1.0."+codeBumped
  108. }