background

As an important branch of Android client technology, componentization has been actively explored and practiced by the industry in recent years. The various Android development teams within each major factory are also trying and practicing different componentization solutions, and there are many high-quality outputs on componentized communication frameworks. This paper mainly introduces our componentization scheme, hoping to inspire students engaged in Android componentization development.

Why componentize

Why do so many teams have componentized practices in recent years? What benefits does componentization bring to our projects and code? We believe that componentization offers two major benefits:

1. Improve component reusability

Some people might think that improving reusability is simply a matter of making the code that needs to be reused into an Android Module, packaging the AAR and uploading the code repository so that these features can be easily introduced and used. However, we think that this is not enough. Whether the AAR library of the upload warehouse can be easily reused needs to be constrained by component-based rules, so as to improve the convenience of reuse.

2. Reduce coupling between components

We need to use componentized rules to break the code into modules with high cohesion and low coupling. Modules cannot be called directly between modules, which requires the support of the componentized communication framework. Reduced coupling between components has two immediate benefits: first, the code is more maintainable; Second, it reduces the Bug rate of modules.

How to achieve componentization

To realize componentization, the following issues need to be considered:

  • Code decoupling. It is time-consuming and labor-intensive to take apart and decouple a huge project, but it is also the most basic and important step

  • Data transfer. Each component has the potential to be used by other components, the transfer of data from main project to component and from component to component

  • The UI jump.

  • Component life cycle. Component load, unload, and dimension reduction lifecycle

  • Integration debugging. How do you compile components on demand during development? Only one or two components may be integrated at a time, which greatly reduces compile time and improves development efficiency.

  • Code isolation. How to prevent coupling.

Below to introduce the most complete is cut in Android componentization of actual combat, cover the whole Internet companies, being limited by the space will not show all content, screenshots show only a part of a complete content is organized into PDF documents, if you just need the full version of the Android componentization best practice PDF, available free here.

Chapter 1 Understanding the componentization of Android

1. The difference between componentization and modularization

  1. The difference between componentization and plug-in

  2. Advantages of componentized development

  3. Business logic layer

5. Solve problems from componentized combat

  1. Android componentization foundation

Chapter two: Componentization of Android

1. Componentized demonstration cases

  • Modularization and componentization

  • modular

  • componentization

  • Componentization Demo

  • Project analysis

  • Components application and Library switch dynamically

  • Data passing and method calls between components

  • Component class (e.g. Fragment) fetching, component page hopping and communication

2. Practical WanAndroid APP componentization project with demo

  • Introduction to the

  • Version update

  • rendering

  • The main function

  • Project directory structure

  • Major Open Source frameworks

Chapter 3 Evolution of Architecture (Dachang)

1. Componentized architecture practice from Zhixing Android project

  • preface

  • An overview of the

  • Reasons and goals for componentization

  • The overall planning of componentized architecture adjustment

  • Some problems encountered in componentized architecture adjustment

  • Practical results of componentized architecture

2. Get the App

  • A fully componentized Demo for Android is released

  • JIMU Usage Guide

  • The perception of componentized decomposition

  • Android is fully componentized – code and resources isolated

  • Code isolation

  • Resource isolation

  • Debug switch

Componentization: Code isolation does not make sequential initialization of components difficult

  • Root of the problem

  • Why not use official StartUp instead of building wheels

  • Design ideas

  • Directed acyclic graph (DAG)

  • Check ring

  • The sorting method that fits the requirements

  • Task Description

  • Used in JIMU

  • Important items

3. WeChat App

  • Practice of wechat Android modular architecture reconstruction

  • Wechat Android architecture history

  • Why restructure wechat again

  • Remodel modularity

  • Trade-offs and choices

  • Outside the code, inside the architecture

Mogujie App

  • The componentization of Mogujie App

  • implementation

  • Component lifecycle management

  • Shell project

  • Problems encountered

  • Continuous integration

  • Surrounding facilities

  • summary

The road to componentization of Mogujie App

  • Unified invocation implementation

  • Categories unify the exposed interfaces of components

  • More explicit

  • Register the URL that this component cares about

  • Registers methods/properties that this component can call

  • Respond differently at different stages of the App lifecycle

  • Some responses to Casatwy

  • summary

5 iQiyi App

  • About componentization

  • IPC communication based on Service

  • The core appeal of componentized cross-process communication

  • Andromeda

  • The architecture analysis

6. Meituan App

  • Evolution of the container architecture of the takeaway client

  • background

  • Meituan take-out business introduction

  • Historical architecture overview of Meituan Takeout mobile terminal

Panorama of Container architecture of Meituan Takeout

  • What is containerized architecture

  • Advantages of containerized architecture

  • Overview of takeaway container architecture

  • The challenge of containerization

  • Delivery cross – end container construction

  • MRN container

  • Titans to container

Takeaway page container construction

  • Page container design idea

  • Standardize business building blocks

  • summary

Metrics for containerized takeout architecture

  • Characteristics of containerized architecture metrics

  • Link indicators

  • Key indicators

  • Monitoring operation and maintenance of takeaway container architecture

  • The publishing capability of the takeaway container architecture

  • Containerized architecture publishing system

  • Follow the release process

  • Bundle Resource Publishing

  • A combination of publishing capabilities

7. Meituan Android componentized solution and component message bus Modular Event actual combat

  • background

  • The state before componentization

  • Componentization scheme research

  • Research the componentization scheme of other teams in Meituan

  • Componentization scheme

  • Modular message bus framework Modular – Event

  • Implementation of the component message bus Modulan-Event

  • The structure of the message bus modular- Event

  • Use dynamic proxies for runtime invocation

  • Subscribe and send patterns

8. Evolution of Meituan Android message Bus: Replace RxBus and EventBus with LiveDataBus

  • background

  • Publish/subscribe

  • The emergence of RxBus

  • Introduce the idea of LiveDataBus

  • Why use LiveData to build the Data communication bus LiveDataBus

  • Design and architecture of LiveDataBus

  • LiveDataBus is finally implemented

9.WMRouter: Android open source routing framework

10. Meituan Cat’s Eye Android modular combat – probably the most detailed modular combat

11. Ctrip App (too long to show all)

12. Alipay App

.

Conclusion: * * The code structure clear, after * * componentization layered structure and the interaction between the very clear, any one of the team can easily create the code structure diagrams, this is not going to do it before, and each component of compile time from 10 minutes to a few seconds, has made great improve the work efficiency, the most critical or after decoupling, Each time you develop requirements, you are faced with less and less code, and you don’t have to carry so much code burden, which can be said to achieve the ideal situation of “less code to write”. If you’re an Android developer, it’s important to learn about componentization, and it’s important to understand how it works.

If you need this Android componentization PDF, you can click here to get a quick access to it. It’s free to share with your learning heart.

Sorting is not easy, feel helpful friends can help to share support like a small series oh ~

Your support, my motivation; I wish you a bright future and continuous offer!!

Learn more about Android architectureClick here to obtain it.