build.gradle 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. plugins {
  2. id 'com.android.application'
  3. }
  4. android {
  5. compileSdk 31
  6. defaultConfig {
  7. applicationId "com.wisewoods.edunative"
  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 : "1500026201",
  22. XG_ACCESS_KEY: "AYRKBUX8G6AK",
  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('./edunative.jks')
  35. keyAlias 'edunative'
  36. storePassword 'edunative'
  37. keyPassword 'edunative'
  38. }
  39. }
  40. compileOptions {
  41. sourceCompatibility JavaVersion.VERSION_1_8
  42. targetCompatibility JavaVersion.VERSION_1_8
  43. }
  44. packagingOptions {
  45. jniLibs {
  46. keepDebugSymbols += ['*/armeabi/libYTCommon.so', '*/armeabi-v7a/libYTCommon.so', '*/x86/libYTCommon.so', '*/arm64-v8a/libYTCommon.so']
  47. pickFirsts += ['**/libc++_shared.so']
  48. }
  49. }
  50. }
  51. dependencies {
  52. implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
  53. implementation project(path: ':base')
  54. implementation 'com.github.azhon:AppUpdate:3.0.5'
  55. implementation 'com.qcloud.cos:cos-android:5.7.3'
  56. implementation 'com.tencent.tpns:tpns:1.2.7.1-release'
  57. implementation 'io.github.youth5201314:banner:2.2.2'
  58. implementation 'com.pgyer:analytics:4.2.0'
  59. implementation 'com.tsy.social:social-sdk-core:2.0.0'
  60. implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5'
  61. implementation 'com.tencent.liteav:LiteAVSDK_TRTC:9.5.11207'
  62. implementation 'com.tencent.imsdk:imsdk-plus:6.0.1992'
  63. implementation 'xyz.doikki.android.dkplayer:dkplayer-java:3.3.5'
  64. implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.5'
  65. implementation 'xyz.doikki.android.dkplayer:videocache:3.3.5'
  66. implementation 'xyz.doikki.android.dkplayer:player-exo:3.3.5'
  67. implementation 'com.google.android.flexbox:flexbox:3.0.0'
  68. testImplementation 'junit:junit:4.13.2'
  69. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  70. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  71. }
  72. task updateVersionCode(){
  73. doFirst{
  74. // 获取 gradle.properties 文件
  75. def gradleProperties = file('../version.properties')
  76. // 读取里面的键值对
  77. def properties = new Properties()
  78. properties.load(new FileInputStream(gradleProperties))
  79. // 获取里面的 APP_VERSION_CODE 进行 +1
  80. def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1
  81. // 重新赋值
  82. properties['APP_VERSION_CODE'] = codeBumped.toString()
  83. // 写入
  84. properties.store(gradleProperties.newWriter(), null)
  85. }
  86. }
  87. project.tasks.whenTaskAdded { Task theTask ->
  88. if (theTask.name == 'assembleRelease' || theTask.name == 'assembleDebug') {
  89. theTask.dependsOn(updateVersionCode)
  90. theTask.mustRunAfter(updateVersionCode) // updateVersionCode在assembleRelease之前执行
  91. }
  92. }
  93. //preBuild.dependsOn(updateVersionCode)
  94. def getMyAppVersionCode() { //获取APP版本号
  95. def gradleProperties = file('../version.properties')
  96. def properties = new Properties()
  97. properties.load(new FileInputStream(gradleProperties))
  98. def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1
  99. return codeBumped as int
  100. }
  101. def getMyAppVersionName() { //获取APP版本号
  102. def gradleProperties = file('../version.properties')
  103. def properties = new Properties()
  104. properties.load(new FileInputStream(gradleProperties))
  105. def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1
  106. return "1.0."+codeBumped
  107. }