基础组件库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

build.gradle 7.2 KiB

4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. // 添加插件
  2. def localProperties = new Properties()
  3. def localPropertiesFile = rootProject.file('local.properties')
  4. if (localPropertiesFile.exists()) {
  5. localPropertiesFile.withReader('UTF-8') { reader ->
  6. localProperties.load(reader)
  7. }
  8. }
  9. def flutterRoot = localProperties.getProperty('flutter.sdk')
  10. if (flutterRoot == null) {
  11. throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
  12. }
  13. def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  14. if (flutterVersionCode == null) {
  15. flutterVersionCode = '1'
  16. }
  17. def flutterVersionName = localProperties.getProperty('flutter.versionName')
  18. if (flutterVersionName == null) {
  19. flutterVersionName = '1.0'
  20. }
  21. // 获取当前时间(年月日)
  22. def releaseTime() {
  23. return new Date().format("YYYYMMdd", TimeZone.getTimeZone("UTC"))
  24. }
  25. apply plugin: 'com.android.application'
  26. apply plugin: 'com.mob.sdk'
  27. apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
  28. android {
  29. compileSdkVersion 28
  30. lintOptions {
  31. disable 'InvalidPackage'
  32. }
  33. // 默认配置
  34. defaultConfig {
  35. applicationId "cn.zhios.zhiying"
  36. minSdkVersion 21
  37. targetSdkVersion 28
  38. versionCode 1
  39. versionName "1.0"
  40. aaptOptions.cruncherEnabled = false
  41. aaptOptions.useNewCruncher = false
  42. multiDexEnabled true
  43. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  44. ndk {
  45. //选择要添加的对应cpu类型的.so库。
  46. abiFilters 'armeabi', 'armeabi-v7a', 'x86','x86_64', 'mips', 'mips64', 'arm64-v8a'
  47. }
  48. }
  49. buildTypes {
  50. debug {
  51. buildConfigField "boolean", "LOG_DEBUG", "true"
  52. minifyEnabled false
  53. zipAlignEnabled true
  54. shrinkResources false
  55. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  56. }
  57. release {
  58. buildConfigField "boolean", "LOG_DEBUG", "false"
  59. minifyEnabled false
  60. shrinkResources false
  61. zipAlignEnabled true
  62. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  63. }
  64. }
  65. dexOptions {
  66. //最大堆内存
  67. javaMaxHeapSize "4g"//4g
  68. //使用增量模式构建
  69. incremental true
  70. //是否支持大工程模式
  71. jumboMode = true
  72. //预编译
  73. preDexLibraries = false
  74. //线程数
  75. threadCount = 8
  76. }
  77. //
  78. // // 签名配置
  79. signingConfigs {
  80. // 智夜生活
  81. zhiying {
  82. storeFile file('zhiying.jks')
  83. storePassword 'zhioscom'
  84. keyAlias 'zysh'
  85. keyPassword 'zhioscom'
  86. v1SigningEnabled true
  87. v2SigningEnabled true
  88. }
  89. }
  90. flavorDimensions "app"
  91. // 应用信息配置
  92. productFlavors {
  93. // 智夜生活
  94. zhiying {
  95. applicationId "cn.zhios.zhiying"
  96. versionCode 1
  97. dimension "app"
  98. versionName '1.0.0'
  99. // 签名信息
  100. signingConfig signingConfigs.zhiying
  101. }
  102. }
  103. // 打包脚本
  104. android.applicationVariants.all { variant ->
  105. if (variant.buildType.name != "debug") {
  106. variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk")
  107. }
  108. variant.outputs.all { output ->
  109. def outputFile = output.outputFile
  110. if (outputFile != null && outputFile.name.endsWith('.apk')) {
  111. //这里修改apk文件名
  112. def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk"
  113. outputFileName = fileName
  114. }
  115. }
  116. }
  117. configurations.all {
  118. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  119. def requested = details.requested
  120. if (requested.group == 'com.android.support') {
  121. if (!requested.name.startsWith("multidex")) {
  122. details.useVersion '28.0.3'
  123. }
  124. }
  125. resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
  126. }
  127. }
  128. }
  129. flutter {
  130. source '../..'
  131. }
  132. dependencies {
  133. testImplementation 'junit:junit:4.12'
  134. androidTestImplementation 'androidx.test:runner:1.1.1'
  135. androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
  136. }
  137. MobSDK {
  138. appKey "30dc33054b635"
  139. appSecret "396e98c293130c9976fb7428b6b434d6"
  140. ShareSDK {
  141. // platform configuration information
  142. devInfo {
  143. QQ {
  144. appId "1111030588"
  145. appKey "XoHKlrBybXy7ORBt"
  146. shareByAppClient true
  147. bypassApproval false
  148. enable true
  149. }
  150. }
  151. }
  152. }
  153. // 注册SecVerify的相关信息
  154. //MobSDK {
  155. //// appKey "2ed488d929488"
  156. //// appSecret "53d4a16298d283828f2444cdd6d6548a"
  157. // //手机验证登录
  158. // SecVerify {}
  159. //
  160. // //短信
  161. // SMSSDK {}
  162. //
  163. // //调用MobPush,推送
  164. //// MobPush {
  165. //// //设置角标开关(不需要可不设置)
  166. ////// badge true
  167. //// //集成其他推送通道(可选)
  168. //// devInfo {
  169. //// //华为推送配置信息
  170. //// HUAWEI {
  171. //// appId "${HUAWEI_PUSH_ID}"
  172. //// }
  173. //// //魅族推送配置信息
  174. //// MEIZU {
  175. //// appId "${MEIZHU_PUSH_APPID}"
  176. //// appKey "${MEIZHU_PUSH_APPKEY}"
  177. //// }
  178. //// //小米推送配置信息
  179. //// XIAOMI {
  180. //// appId "${XIAOMI_PUSH_APPID}"
  181. //// appKey "${XIAOMI_PUSH_APPKEY}"
  182. //// }
  183. //// //FCM推送通道配置
  184. ////// FCM {
  185. //// //设置默认推送通知显示图标
  186. ////// iconRes "@mipmap/ic_launcher"
  187. ////// }
  188. //// //OPPO推送配置信息
  189. //// OPPO {
  190. //// appKey "${OPPO_PUSH_APPKEY}"
  191. //// appSecret "${OPPO_PUSH_APPSECRET}"
  192. //// }
  193. //// //VIVO推送配置信息
  194. //// VIVO {
  195. //// appId "${VIVO_PUSH_APPID}"
  196. //// appKey "${VIVO_PUSH_APPKEY}"
  197. //// }
  198. //// }
  199. //// }
  200. //
  201. // //分享
  202. // ShareSDK {
  203. // loopShare true
  204. // devInfo {
  205. // SinaWeibo {
  206. // enable true
  207. // }
  208. // Wechat {
  209. //// appId "${Wechat_appid}"
  210. //// appSecret "${Wechat_appSecret}"
  211. // enable true
  212. // withShareTicket true
  213. // bypassApproval false
  214. // }
  215. // QQ {
  216. // enable true
  217. // }
  218. // WechatMoments {
  219. // enable true
  220. // }
  221. // WechatFavorite {
  222. // enable true
  223. // }
  224. // QZone {
  225. // enable true
  226. // }
  227. // }
  228. // }
  229. //
  230. // //网页打开app,接受邀请码
  231. // MobLink {
  232. //// uriScheme "${uri_Scheme}"
  233. //// appLinkHost "${app_LinkHost}"
  234. // }
  235. //}