基础组件库
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ů.
 
 
 
 
 

364 řádky
10 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 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. // 签名配置
  50. signingConfigs {
  51. // 智夜生活
  52. zhiying {
  53. storeFile file('zhiying.jks')
  54. storePassword 'zhioscom'
  55. keyAlias 'zysh'
  56. keyPassword 'zhioscom'
  57. v1SigningEnabled true
  58. v2SigningEnabled true
  59. }
  60. }
  61. flavorDimensions "app"
  62. buildTypes {
  63. debug {
  64. buildConfigField "boolean", "LOG_DEBUG", "true"
  65. minifyEnabled false
  66. zipAlignEnabled true
  67. shrinkResources false
  68. signingConfig signingConfigs.zhiying
  69. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  70. }
  71. release {
  72. buildConfigField "boolean", "LOG_DEBUG", "false"
  73. minifyEnabled false
  74. shrinkResources false
  75. zipAlignEnabled true
  76. signingConfig signingConfigs.zhiying
  77. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  78. }
  79. }
  80. dexOptions {
  81. //最大堆内存
  82. javaMaxHeapSize "4g"//4g
  83. //使用增量模式构建
  84. incremental true
  85. //是否支持大工程模式
  86. jumboMode = true
  87. //预编译
  88. preDexLibraries = false
  89. //线程数
  90. threadCount = 8
  91. }
  92. // 应用信息配置
  93. productFlavors {
  94. // 智夜生活
  95. zhiying {
  96. applicationId "cn.zhios.zhiying"
  97. versionCode 38
  98. dimension "app"
  99. versionName '1.2.38'
  100. // 签名信息
  101. signingConfig signingConfigs.zhiying
  102. }
  103. }
  104. // 打包脚本
  105. android.applicationVariants.all { variant ->
  106. if (variant.buildType.name != "debug") {
  107. variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk")
  108. }
  109. variant.outputs.all { output ->
  110. def outputFile = output.outputFile
  111. if (outputFile != null && outputFile.name.endsWith('.apk')) {
  112. //这里修改apk文件名
  113. def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk"
  114. outputFileName = fileName
  115. }
  116. }
  117. }
  118. configurations.all {
  119. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  120. def requested = details.requested
  121. if (requested.group == 'com.android.support') {
  122. if (!requested.name.startsWith("multidex")) {
  123. details.useVersion '28.0.3'
  124. }
  125. }
  126. resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
  127. }
  128. }
  129. }
  130. flutter {
  131. source '../..'
  132. }
  133. dependencies {
  134. implementation 'androidx.appcompat:appcompat:1.2.0'
  135. implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
  136. testImplementation 'junit:junit:4.12'
  137. androidTestImplementation 'androidx.test:runner:1.1.1'
  138. androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
  139. //登陆
  140. implementation 'com.ali.auth.sdk:alibabauth_core:2.0.0.11@aar'
  141. implementation 'com.ali.auth.sdk:alibabauth_ui:2.0.0.11@aar'
  142. implementation 'com.ali.auth.sdk:alibabauth_ext:2.0.0.11@aar'
  143. //安全组件
  144. implementation 'com.taobao.android:securityguardaar3:5.4.171@aar'
  145. implementation 'com.taobao.android:securitybodyaar3:5.4.99@aar'
  146. implementation 'com.taobao.android:avmpaar3:5.4.36@aar'
  147. implementation 'com.taobao.android:sgmiddletieraar3:5.4.9@aar'
  148. //Mtop
  149. implementation 'com.taobao.android:mtopsdk_allinone_open:3.1.2.5@jar'
  150. //applink
  151. implementation 'com.alibaba.sdk.android:alibc_link_partner:4.1.15@aar'
  152. //ut
  153. implementation 'com.taobao.android:utdid4all:1.5.2'
  154. implementation 'com.alibaba.mtl:app-monitor-sdk:2.6.4.5_for_bc'
  155. // 电商基础组件
  156. implementation 'com.alibaba.sdk.android:AlibcTradeCommon:4.0.0.16@aar'
  157. implementation 'com.alibaba.sdk.android:AlibcTradeBiz:4.0.0.16@aar'
  158. implementation 'com.alibaba.sdk.android:nb_trade:4.0.0.16@aar'
  159. implementation 'com.alibaba:fastjson:1.2.41@jar'
  160. }
  161. MobSDK {
  162. appKey "30dc33054b635"
  163. appSecret "396e98c293130c9976fb7428b6b434d6"
  164. MobLink {
  165. uriScheme "fnoos://cn.zhios.zhiying"
  166. appLinkHost "bied.t4m.cn"
  167. }
  168. //手机验证登录
  169. SecVerify {}
  170. //短信
  171. SMSSDK {}
  172. ShareSDK {
  173. // platform configuration information
  174. devInfo {
  175. QQ {
  176. appId "1111030588"
  177. appKey "XoHKlrBybXy7ORBt"
  178. shareByAppClient true
  179. bypassApproval false
  180. enable true
  181. }
  182. Wechat {
  183. appId "wx598aaef252cd78e4"
  184. appSecret "d2fc2edf9ece746765b3bfc0bf1b230e"
  185. shareByAppClient true
  186. withShareTicket true
  187. bypassApproval false
  188. enable true
  189. }
  190. WechatMoments {
  191. enable true
  192. }
  193. WechatFavorite {
  194. enable true
  195. }
  196. QZone {
  197. appId "1111030588"
  198. appKey "XoHKlrBybXy7ORBt"
  199. enable true
  200. }
  201. SinaWeibo {
  202. enable true
  203. }
  204. }
  205. }
  206. //配置MobPush
  207. MobPush {
  208. //配置厂商推送(可选配置,不需要厂商推送可不配置,需要哪些厂商推送只需配置哪些厂商配置即可)
  209. devInfo {
  210. //配置小米厂商推送
  211. XIAOMI {
  212. appId "您的小米平台appId"
  213. appKey "您的小米平台appKey"
  214. }
  215. //配置华为厂商推送
  216. HUAWEI {
  217. appId "您的华为平台appId"
  218. }
  219. //配置魅族厂商推送
  220. MEIZU {
  221. appId "您的魅族平台appId"
  222. appKey "您的魅族平台appKey"
  223. }
  224. // //配置FCM厂商推送
  225. // FCM {
  226. // //设置默认推送通知显示图标
  227. // iconRes "@mipmap/default_ic_launcher"
  228. // }
  229. //配置OPPO厂商推送
  230. OPPO {
  231. appKey "您的OPPO平台appKey"
  232. appSecret "您的OPPO平台appSecret"
  233. }
  234. //配置VIVO厂商推送
  235. VIVO {
  236. appId "您的VIVO平台appId"
  237. appKey "您的VIVO平台appKey"
  238. }
  239. }
  240. }
  241. }
  242. // 注册SecVerify的相关信息
  243. //MobSDK {
  244. //// appKey "2ed488d929488"
  245. //// appSecret "53d4a16298d283828f2444cdd6d6548a"
  246. // //手机验证登录
  247. // SecVerify {}
  248. //
  249. // //短信
  250. // SMSSDK {}
  251. //
  252. // //调用MobPush,推送
  253. //// MobPush {
  254. //// //设置角标开关(不需要可不设置)
  255. ////// badge true
  256. //// //集成其他推送通道(可选)
  257. //// devInfo {
  258. //// //华为推送配置信息
  259. //// HUAWEI {
  260. //// appId "${HUAWEI_PUSH_ID}"
  261. //// }
  262. //// //魅族推送配置信息
  263. //// MEIZU {
  264. //// appId "${MEIZHU_PUSH_APPID}"
  265. //// appKey "${MEIZHU_PUSH_APPKEY}"
  266. //// }
  267. //// //小米推送配置信息
  268. //// XIAOMI {
  269. //// appId "${XIAOMI_PUSH_APPID}"
  270. //// appKey "${XIAOMI_PUSH_APPKEY}"
  271. //// }
  272. //// //FCM推送通道配置
  273. ////// FCM {
  274. //// //设置默认推送通知显示图标
  275. ////// iconRes "@mipmap/ic_launcher"
  276. ////// }
  277. //// //OPPO推送配置信息
  278. //// OPPO {
  279. //// appKey "${OPPO_PUSH_APPKEY}"
  280. //// appSecret "${OPPO_PUSH_APPSECRET}"
  281. //// }
  282. //// //VIVO推送配置信息
  283. //// VIVO {
  284. //// appId "${VIVO_PUSH_APPID}"
  285. //// appKey "${VIVO_PUSH_APPKEY}"
  286. //// }
  287. //// }
  288. //// }
  289. //
  290. // //分享
  291. // ShareSDK {
  292. // loopShare true
  293. // devInfo {
  294. // SinaWeibo {
  295. // enable true
  296. // }
  297. // Wechat {
  298. //// appId "${Wechat_appid}"
  299. //// appSecret "${Wechat_appSecret}"
  300. // enable true
  301. // withShareTicket true
  302. // bypassApproval false
  303. // }
  304. // QQ {
  305. // enable true
  306. // }
  307. // WechatMoments {
  308. // enable true
  309. // }
  310. // WechatFavorite {
  311. // enable true
  312. // }
  313. // QZone {
  314. // enable true
  315. // }
  316. // }
  317. // }
  318. //
  319. // //网页打开app,接受邀请码
  320. // MobLink {
  321. //// uriScheme "${uri_Scheme}"
  322. //// appLinkHost "${app_LinkHost}"
  323. // }
  324. //}