Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

build.gradle 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. apply plugin: 'com.android.application'
  2. android {
  3. compileSdkVersion rootProject.ext.compileSdkVersion
  4. buildToolsVersion rootProject.ext.buildToolsVersion
  5. defaultConfig {
  6. applicationId "com.hjq.demo"
  7. minSdkVersion 14
  8. targetSdkVersion rootProject.ext.targetSdkVersion
  9. versionCode 10
  10. versionName "1.0"
  11. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  12. }
  13. //APK 签名的那些事:https://www.jianshu.com/p/a1f8e5896aa2
  14. // signingConfigs {
  15. // release {
  16. // keyAlias '密钥别称'
  17. // keyPassword '密钥密码'
  18. // storeFile file('E:/MySign.jks')
  19. // storePassword '密钥库密码'
  20. // }
  21. //
  22. // debug {
  23. // keyAlias '密钥别称'
  24. // keyPassword '密钥密码'
  25. // storeFile file('E:/MySign.jks')
  26. // storePassword '密钥库密码'
  27. // }
  28. // }
  29. buildTypes {
  30. release {
  31. // 不显示Log
  32. buildConfigField "boolean", "LOG_DEBUG", "false"
  33. // 移除无用的resource文件,前提minifyEnabled必须打开
  34. shrinkResources true
  35. // ZipAlign优化
  36. zipAlignEnabled true
  37. // 设置混淆
  38. minifyEnabled true
  39. //加载默认混淆配置涵
  40. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  41. // 正式环境签名
  42. //signingConfig signingConfigs.release
  43. }
  44. debug {
  45. //ZipAlign优化
  46. zipAlignEnabled false
  47. //设置混淆
  48. minifyEnabled false
  49. //加载默认混淆配置涵
  50. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  51. // 开发环境签名
  52. //signingConfig signingConfigs.debug
  53. }
  54. }
  55. flavorDimensions "default"//这个名字貌似随便取,也可以有多个,总之一定要有
  56. //多渠道打包
  57. productFlavors {
  58. kuan {} //酷安
  59. tencent {} //应用宝
  60. baidu {} //百度
  61. xiaomi {} //小米
  62. huawei {} //华为
  63. google {} //谷歌
  64. productFlavors.all { flavor ->
  65. flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
  66. }
  67. }
  68. // JNI 目录
  69. sourceSets {
  70. main {
  71. jniLibs.srcDirs = ['libs']
  72. }
  73. }
  74. }
  75. // api 与 implementation的区别:https://www.jianshu.com/p/8962d6ba936e
  76. dependencies {
  77. // 依赖 libs 目录下所有 Jar 包
  78. implementation fileTree(include: ['*.jar'], dir: 'libs')
  79. // 基础库(不包任何第三方框架)
  80. implementation project(':base')
  81. // 自定义 View
  82. implementation project(':widget')
  83. // 友盟
  84. implementation project(':umeng')
  85. // Dialog
  86. implementation project(':dialog')
  87. // 示例:添加一个 aar 包
  88. // implementation(name: 'password_dialog', ext: 'aar')
  89. implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
  90. implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
  91. implementation "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
  92. implementation "com.android.support:cardview-v7:$rootProject.ext.supportLibraryVersion"
  93. implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintlayoutVersion"
  94. // Dex分包,解决 65k 问题
  95. implementation 'com.android.support:multidex:1.0.3'
  96. // ButterKnife注解库:https://github.com/JakeWharton/butterknife
  97. implementation 'com.jakewharton:butterknife:9.0.0-rc1'
  98. annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
  99. // 状态栏沉浸:https://github.com/gyf-dev/ImmersionBar
  100. implementation 'com.gyf.immersionbar:immersionbar:2.3.3-beta09'
  101. // 侧滑功能:https://github.com/bingoogolapple/BGASwipeBackLayout-Android
  102. implementation 'cn.bingoogolapple:bga-swipebacklayout:1.2.0'
  103. // 权限请求框架:https://github.com/getActivity/XXPermissions
  104. implementation 'com.hjq:xxpermissions:5.2'
  105. // 标题栏:https://github.com/getActivity/TitleBar
  106. implementation 'com.hjq:titlebar:5.0'
  107. // 吐司工具类:https://github.com/getActivity/ToastUtils
  108. implementation 'com.hjq:toast:5.2'
  109. // 圆形的ImageView:https://github.com/hdodenhof/CircleImageView
  110. implementation 'de.hdodenhof:circleimageview:2.2.0'
  111. // RecyclerView:https://github.com/CymChad/BaseRecyclerViewAdapterHelper
  112. // 工具类集合:https://github.com/Blankj/AndroidUtilCode
  113. // 图片选择:https://github.com/zhihu/Matisse
  114. // 上拉下拉:https://github.com/bingoogolapple/BGARefreshLayout-Android
  115. // 轮播图:https://github.com/bingoogolapple/BGABanner-Android
  116. // 二维码:https://github.com/bingoogolapple/BGAQRCode-Android
  117. }
  118. repositories {
  119. flatDir {
  120. dirs 'libs' //就是你放aar的目录地址
  121. }
  122. }