build.gradle 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. apply plugin: 'com.android.application'
  2. Properties props = new Properties()
  3. props.load(new FileInputStream(file("signing.properties")))
  4. Properties serverProps = new Properties()
  5. def propFile = file('server_url.properties')
  6. def testApiUrl, proApiUrl
  7. if (propFile.canRead()) {
  8. serverProps.load(new FileInputStream(propFile))
  9. if (serverProps != null) {
  10. testApiUrl = serverProps['testApiUrl']
  11. proApiUrl = serverProps['proApiUrl']
  12. }
  13. }
  14. android {
  15. compileSdkVersion rootProject.ext.compileSdkVersion
  16. buildToolsVersion rootProject.ext.buildToolsVersion
  17. defaultConfig {
  18. applicationId "com.tongyu.luck.happywork"
  19. minSdkVersion rootProject.ext.minSdkVersion
  20. targetSdkVersion rootProject.ext.targetSdkVersion
  21. multiDexEnabled true
  22. multiDexKeepProguard file("multidexKeep.pro")//腾讯bugly的类放到主Dex
  23. <<<<<<< Updated upstream
  24. versionCode 331
  25. versionName "3.3.1"
  26. =======
  27. versionCode 334
  28. versionName "3.3.4"
  29. >>>>>>> Stashed changes
  30. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  31. flavorDimensions "versionCode"
  32. ndk {
  33. abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "arm64-v8a", "x86_64"
  34. }
  35. }
  36. productFlavors {
  37. hbpro {
  38. applicationId "com.tongyu.luck.happywork"
  39. buildConfigField('String', 'baseApiUrl', proApiUrl)
  40. buildConfigField('String', 'BUGLY_ID', "\"f39e8bfcb6\"")
  41. manifestPlaceholders = [
  42. AMAP_KEY : "0e0cda5ece292d81a67ab1277973164d",
  43. WX_APPID_VALUE: "wxeb8c2418a8ace030",
  44. ]
  45. }
  46. hbtest {
  47. applicationId "com.tongyu.luck.happywork.test"
  48. buildConfigField('String', 'baseApiUrl', testApiUrl)
  49. buildConfigField('String', 'BUGLY_ID', "\"ea1dc909cd\"")
  50. manifestPlaceholders = [
  51. AMAP_KEY : "af3f5c403ce607e9603e5087b1b2c961",
  52. WX_APPID_VALUE: "wx9c053f7126db0b28",
  53. ]
  54. }
  55. }
  56. signingConfigs {
  57. debug {
  58. keyAlias props['KEY_ALIAS']
  59. keyPassword props['KEY_PASSWORD']
  60. storeFile file(props['KEYSTORE_FILE'])
  61. storePassword props['KEYSTORE_PASSWORD']
  62. }
  63. release {
  64. keyAlias props['KEY_ALIAS']
  65. keyPassword props['KEY_PASSWORD']
  66. storeFile file(props['KEYSTORE_FILE'])
  67. storePassword props['KEYSTORE_PASSWORD']
  68. }
  69. }
  70. //自动生成指定名称的release发布版的 apk文件
  71. android.applicationVariants.all { variant ->
  72. variant.outputs.all { output ->
  73. outputFileName = "happyJob_${variant.productFlavors[0].name}_${buildType.getName()}_${defaultConfig.versionName}.apk"
  74. }
  75. }
  76. buildTypes {
  77. release {
  78. //混淆
  79. minifyEnabled true
  80. //Zipalign优化
  81. zipAlignEnabled true
  82. // 移除无用的resource文件
  83. shrinkResources true
  84. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  85. signingConfig signingConfigs.release
  86. }
  87. debug {
  88. signingConfig signingConfigs.release
  89. }
  90. }
  91. }
  92. dependencies {
  93. implementation fileTree(include: ['*.jar'], dir: 'libs')
  94. implementation project(':baselibrary')
  95. implementation 'com.jakewharton:butterknife:8.0.1'
  96. annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
  97. }