build.gradle 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-kapt'
  4. apply plugin: 'kotlin-android-extensions'
  5. android {
  6. compileSdkVersion rootProject.ext.android["compileSdkVersion"]
  7. buildToolsVersion rootProject.ext.android["buildToolsVersion"]
  8. useLibrary 'org.apache.http.legacy'
  9. compileOptions {
  10. targetCompatibility JavaVersion.VERSION_1_8
  11. sourceCompatibility JavaVersion.VERSION_1_8
  12. }
  13. defaultConfig {
  14. multiDexEnabled true
  15. applicationId "me.hegj.wandroid"
  16. minSdkVersion rootProject.ext.android["minSdkVersion"]
  17. targetSdkVersion rootProject.ext.android["targetSdkVersion"]
  18. versionCode rootProject.ext.android["versionCode"]
  19. versionName rootProject.ext.android["versionName"]
  20. testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
  21. ndk {
  22. // 设置支持的SO库架构
  23. abiFilters 'armeabi-v7a'
  24. }
  25. }
  26. signingConfigs {
  27. def alias = "wandroid"
  28. def password = "password"
  29. def filePath = "wandroid.jks"
  30. debug {
  31. keyAlias alias
  32. keyPassword password
  33. storeFile file(filePath)
  34. storePassword(password)
  35. }
  36. release {
  37. keyAlias alias
  38. keyPassword password
  39. storeFile file(filePath)
  40. storePassword(password)
  41. }
  42. }
  43. buildTypes {
  44. debug {
  45. buildConfigField "boolean", "LOG_DEBUG", "true"
  46. buildConfigField "boolean", "USE_CANARY", "false"
  47. minifyEnabled false
  48. shrinkResources false
  49. zipAlignEnabled false
  50. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  51. }
  52. release {
  53. buildConfigField "boolean", "LOG_DEBUG", "false"
  54. buildConfigField "boolean", "USE_CANARY", "false"
  55. minifyEnabled true//开启混淆
  56. shrinkResources true
  57. zipAlignEnabled true//去除无用资源
  58. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  59. }
  60. }
  61. lintOptions {
  62. disable 'InvalidPackage'
  63. disable "ResourceType"
  64. abortOnError false
  65. }
  66. dexOptions {
  67. javaMaxHeapSize "4g"
  68. jumboMode = true
  69. preDexLibraries = false
  70. additionalParameters = [
  71. '--multi-dex',//多分包
  72. '--set-max-idx-number=60000'//每个包内方法数上限
  73. ]
  74. }
  75. }
  76. dependencies {
  77. implementation fileTree(include: ['*.jar'], dir: 'libs')
  78. //androidX基础库
  79. implementation "androidx.appcompat:appcompat:1.1.0-rc01"
  80. implementation 'com.google.android.material:material:1.1.0-alpha09'
  81. implementation "androidx.constraintlayout:constraintlayout:1.1.3"
  82. implementation "androidx.preference:preference:1.1.0-rc01"
  83. implementation "androidx.cardview:cardview:1.0.0"
  84. //dagger
  85. annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
  86. kapt rootProject.ext.dependencies["dagger2-compiler"]
  87. //黄油刀
  88. implementation "com.jakewharton:butterknife:10.0.0"
  89. kapt "com.jakewharton:butterknife-compiler:10.0.0"
  90. //test
  91. testImplementation rootProject.ext.dependencies["junit"]
  92. debugImplementation rootProject.ext.dependencies["canary-debug"]
  93. releaseImplementation rootProject.ext.dependencies["canary-release"]
  94. testImplementation rootProject.ext.dependencies["canary-release"]
  95. //kotlin
  96. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  97. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"
  98. //项目用到的库大部分封装在里面 具体在 config.gradle
  99. implementation rootProject.ext.customLibs
  100. }
  101. repositories {
  102. mavenCentral()
  103. }