|
基于Android开发的组件化应用与实践
|
Abstract:
针对当前Android应用开发存在协作开发冲突多、业务代码耦合高、开发效率低以及应用体量大等问题,本文提出一种组件化开发方案。通过IDE将项目划分成多个业务组件,各个组件间相互独立,并使用Gradle工具将开发模式调整为组件模式或集成模式。在组件模式下,基于单个组件进行编译调试;在集成模式下,整合所有组件生成最终APP。但是Android开发中常用的组件间通信路由框架功能复杂、体量较大,而且组件间相互独立易造成资源冗余,这会增加应用的体量,提高安装的流量成本。因此,提出一种新的轻量级组件间通信路由框架ERouter并结合资源压缩、选取轻量级第三方库等操作实现应用优化。本文以智慧宿管平台为例,以上方案有效地解决了应用开发中协作开发冲突多、代码耦合高、项目工程编译慢以及应用体量大等问题。
Aiming at the current problems of Android application development, such as conflicts in collabo-rative development, high coupling of business code, low development efficiency, and large appli-cation volume, this article proposes a componentized development solution. The project is divided into multiple business components through the IDE; each component is independent of each other, and the development mode is adjusted to a component mode or an integration mode using Gradle tools. In component mode, compiling and debugging are based on a single component; in integrated mode, the final APP is generated with all components integrated. However, the intercomponent communication routing framework commonly used in Android development is complex in function and large in volume, and the independence between components easily results in resource redundancy, which will increase the volume of the application and increase the cost of installation traffic. Therefore, a new lightweight inter-component communication routing framework ERouter is proposed, which combines resource compression and selection of lightweight third-party libraries to achieve application optimization. This article takes the intelligent dormitory manager platform as an example. The above scheme effectively solves the problems including many collaborative development conflicts, high code coupling, slow project engineering compilation, and large application volume in application development.
[1] | 何群芳, 时招军. 基于Android的内存泄漏与溢出研究[J]. 软件导刊, 2018, 17(2): 50-52. |
[2] | 李平, 陈杰, 王杰. 基于互联网+的专家服务平台APP设计与实现[J]. 自动化技术与应用, 2019, 38(8): 53-58. |
[3] | 包晓安, 徐海, 张娜, 吴彪, 钱俊彦. 基于深度学习的语音识别模型及其在智能家居中的应用[J]. 浙江理工大学学报(自然科学版), 2019, 41(2): 217-223. |
[4] | 尹孟征. 基于Android的APP开发平台综述[J]. 通信电源技术, 2016, 33(4): 154-155. |
[5] | 曾健平, 邵艳洁. Android系统架构及应用程序开发研究[J]. 微计算机信息, 2011, 27(9): 1-3. |
[6] | 赵静. Android系统架构及应用程序开发研究[J]. 自动化与仪器仪表, 2017(1): 86-87+90. |
[7] | 夏羿, 徐振宇. 移动平台竞争: 开放策略与市场结构——引入可竞争市场的双边市场竞争模型[J/OL]. 经济与管理, 2019(6): 34-43. |
[8] | 周宇, 尹生强, 王冬青, 王英杰. 基于Eclipse和Android系统的App开发平台搭建研究[J]. 青岛大学学报(工程技术版), 2016, 31(3): 49-53. |
[9] | 邹绍武, 苏贵斌. Android应用开发中图片压缩技术的研究应用[J]. 计算机技术与发展, 2015, 25(6): 106-109+113. |
[10] | 殷涛, 崔佳冬. 基于Android软件开发组件化研究[J]. 计算机应用与软件, 2019, 36(9): 16-20. |
[11] | 季通明, 鲍胜利. JPEG2000图像压缩算法在Android平台的应用[J]. 计算机应用, 2017, 37(S2): 203-206. |
[12] | Giaime, G., Maurizio, P. and Daniele, D.G. (2012) Objective Assessment of the WebP Image Coding Algorithm. Signal Processing: Image Communication, 27, 867-874. https://doi.org/10.1016/j.image.2012.01.011 |
[13] | Tenev, V., Zhang, B. and Becker, M. (2016) Android Build Dependency Analysis. 2016 IEEE 24th International Conference on Program Comprehension, Austin, TX, 16-17 May 2016, 1-4. |
[14] | Buchgeher, G. and Weinreich, R. (2009) Tool Support for Component-Based Software Architectures. 2009 16th Asia-Pacific Software Engineering Conference, Penang, Malaysia, 1-3 December 2009, 127-134. https://doi.org/10.1109/APSEC.2009.67 |
[15] | Mahdi, D., Ebert, J., Marvin, G. and Engels, G. (2018) Model-Integrating Development of Software Systems: A Flexible Component-Based Approach. Software & Systems Modeling, 18, 2557-2586. |
[16] | Riganelli, O., Micucci, D. and Mariani, L. (2019) From Source Code to Test Cases: A Comprehensive Benchmark for Resource Leak Detection in Android Apps. Software: Practice & Experience, 49, 540-548. https://doi.org/10.1002/spe.2672 |
[17] | 刘洁瑞, 巫雪青, 严俊, 等. 针对Android资源泄漏的基准测试集的构造与评测[J]. 计算机应用, 2017, 37(4): 1129-1134. |