Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

background

As an important branch of Android client technology, componentization has been the direction of active exploration and practice in the industry in recent years. The various Android development teams in each big factory are also trying and practicing different componentized solutions, and there are many high-quality outputs in the componentized communication framework. This article mainly introduces our componentization solution, hoping to inspire students who are engaged in Android componentization development.

Why componentize

In recent years, why do so many teams practice componentization? What benefits can componentization bring to our projects and codes? We believe that componentization can bring two biggest benefits:

1. Improve component reusability

Some people may think that it is very simple to improve the reusability, directly make the code that needs to be reused into an Android Module, package the AAR and upload the code warehouse, then this part of the function can be easily introduced and used. But we feel that this is not enough. Whether the AAR library uploaded to the warehouse can be easily reused needs to be restricted by componentized rules, so as to improve the convenience of reuse.

2. Reduce the coupling between components

We need to split the code into different modules through the rules of componentization, and the modules must be highly cohesive and low-coupling. The modules cannot be called directly either, which requires the support of the component communication framework. Reducing the coupling between components can bring two direct benefits: first, the code is easier to maintain; second, it reduces the bug rate of the module.

How to achieve componentization

The issues that need to be considered in order to achieve componentization mainly include the following:

  • Code decoupling. Disassembling and decoupling a huge project is a very time-consuming and labor-intensive work, but it is also the most basic and important step

  • Data transfer. Each component may be provided to other components, the main project and the component, the data transfer between the component and the component

  • UI jump.

  • The life cycle of the component. Life cycle of component loading, unloading and dimension reduction

  • Integrated debugging. How to compile components on demand during the development phase? There may be only one or two components involved in the integration during a debugging, so the compilation time will be greatly reduced and development efficiency will be improved.

  • Code isolation. How to prevent coupling.

The following is the most complete Android componentized practical arrangement on the entire network, covering the entire Internet company. Due to space limitations, not all content will be displayed. Only screenshots can be displayed. The complete content has been organized into a PDF document. If you just need it This full version of the best practical PDF of Android componentization can be obtained for free by clicking here.

The first chapter Android componentization

1. The difference between componentization and modularization

  1. The difference between componentization and plug-in

  2. Advantages of component development

  3. Business logic layer

5. Solve the problem from componentized actual combat

  1. Android componentization foundation

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

Chapter Two A Preliminary Study of Android Componentization

1. Componentized demonstration case

  • Modularization and componentization

  • Modular

  • Componentization

  • Componentized Demo

  • Project Analysis

  • Dynamic switching of component application and library

  • Data transfer and method calls between components

  • Obtaining component classes (for example: Fragment), and boasting component page jump and communication

2. WanAndroid APP componentized project actual combat with demo

  • Introduction

  • new version update

  • Effect picture

  • The main function

  • Project directory structure

  • Main open source framework

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

Chapter 3 Architecture Evolution (Dachang Chapter)

1. Looking at the practice of componentized architecture from the Zhixing Android project

  • Preface

  • Overview

  • Reasons and goals of component adjustment

  • Overall planning of componentized architecture adjustment

  • Some problems encountered in the adjustment of componentized architecture

  • Practice results of componentized architecture

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)
2. Get the App

  • Android completely componentized demo released

  • JIMU User Guide

  • The perception of component split

  • Android is completely componentized-code and resource isolation

  • Code isolation

  • Resource isolation

  • Debug switch

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

Componentization: Code isolation is also not difficult for the sequential initialization of components

  • The root of the problem

  • Why not use the official StartUp and choose to make wheels

  • Design ideas

  • Directed Acyclic Graph (DAG)

  • Ring check

  • Sorting method that meets needs

  • Description of the task

  • Use in JIMU

  • Important matters

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

3. WeChat App

  • Refactoring Practice of WeChat Android Modular Architecture

  • History of WeChat Android Architecture

  • Why refactor WeChat again

  • Reinventing modularity

  • Choices and choices

  • Outside the code, inside the architecture

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

4. Mogujie App

  • Componentization of Mogujie App

  • Method to realize

  • Component life cycle management

  • Shell Engineering

  • Problems encountered

  • Continuous integration

  • Surrounding facilities

  • summary

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)
Componentization of Mogujie App·Continued

  • Unified call implementation

  • Unify the exposed interfaces of components through Category

  • More explicit statement

  • Register the URL that this component cares about

  • Register the methods/properties that this component can be called

  • Make different responses at different stages of the App life cycle

  • Some responses to casatwy

  • summary

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)
5 iQiyi App

  • About componentization

  • Service-based IPC communication

  • The core appeal of componentized cross-process communication

  • Andromeda

  • Architecture analysis

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

6. Meituan App

  • The evolution of the takeaway client containerized architecture

  • background

  • Meituan takeaway business introduction

  • Overview of the historical architecture of Meituan's mobile terminal

Meituan takeaway containerized architecture panorama

  • What is a containerized architecture

  • Advantages of containerized architecture

  • Takeaway containerized architecture panorama

  • The challenge of containerization

  • Takeaway cross-end container construction

  • MRN container

  • Titans container

Takeaway page container construction

  • Design ideas for page containerization

  • Standardization of business building blocks

  • summary

Metrics for takeaway containerized architecture

  • Characteristics of containerized architecture metrics

  • Link index

  • key indicator

  • Monitoring operation and maintenance of takeaway containerized architecture

  • Release capability of takeaway containerized architecture

  • Containerized architecture release system

  • Follow version release process

  • Bundle resource release

  • Comprehensive use of multiple publishing capabilities

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

7. Meituan Android componentization solution and component message bus modular-event actual combat

  • background

  • State before componentization

  • Componentized solution research

  • Research on Meituan's other team componentization solutions

  • Component solution

  • Componentized message bus framework modular-event

  • The realization of component message bus modular-event

  • The structure of the message bus modular-event

  • Use dynamic proxy to implement runtime call

  • Subscription and delivery mode

8. The evolution of Meituan's Android message bus: replacing RxBus and EventBus with LiveDataBus

  • background

  • Publish/subscribe model

  • The emergence of RxBus

  • The idea of ​​introducing LiveDataBus

  • Why use LiveData to build a data communication bus LiveDataBus

  • Design and architecture of LiveDataBus

  • LiveDataBus final implementation

9. WMRouter: Meituan takeaway Android open source routing framework

10. Meituan Maoyan android modular combat-probably the most detailed modular combat

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)
11. Ctrip App (It's too long to show all of it)

12. Alipay App

......

Director of Bytedance's best practice summary of Android componentization, covering the entire Internet company (with source code)

Summary: After componentization, the code structure is very clear, the hierarchical structure and the interaction between them are very clear, anyone in the team can easily draw the code structure diagram, which was impossible to do before, and The compilation time of each component has dropped from 10 minutes to tens of seconds, and the work efficiency has been greatly improved. The most important thing is that after decoupling, each time you develop a demand, you will face less and less code, so you don’t have to carry it. The heavy code burden can be said to achieve the ideal situation of "the less code you write". If you are an Android developer, it is very necessary to learn componentization, and a deep understanding of the actual combat of componentization is the most important thing.

If you just need this Android componentized actual combat PDF document, you can click here to quickly get the channel, the information is free to share with you who love to learn.

It is not easy to organize, friends who feel helpful can help like, share and support the editor~

Your support, my motivation; I wish you all a bright future and constant offers! ! !

More information about the Android architecture can be found here .

Guess you like

Origin blog.51cto.com/14786417/2588667