基础组件库
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

247 linhas
6.8 KiB

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