Preface
Plug-in technology has actually been very mature , But the corresponding problem , If you haven't really practiced , I don't know how many problems there are , How many technical details will be involved , How many outsiders worship the bright looking technical cattle are 『 pluggable 』 These three words are tortured to death , This is for Android The damage to the whole ecosystem can not be ignored .
So what does this componentization mean ? Let me say my own understanding , Maybe not , Please advise :
adopt gradle Configuration mode , Will hit debug Bao He release Separate the bags . This will have a benefit , Develop a module , stay debug When , It can be made into one apk , Run the test independently , Can be completely independent of the entire host APP All the other components of ; Wait until you have to call release When the package , Then take this module as a library , become involved aar , As the whole host APP Part of . and debug and release All switches are through gradle To configure , Seamless switching can be achieved . As for the jump between modules , You can use aliases , Rather than using Activity and Fragment Class name . So all the modules and hosts APP Are completely decoupled , It completely solves the problems of cross dependence caused by parallel development .
So this is the way to think about it , Let's look at some other details :
- stay Android One of the cool things about this is , As library When ,aar Reference dependency in , Host Application There are the same reference dependencies in , It doesn't pack two copies to the host Application in ;
- Jump between modules , In addition to using aliases , I can think of another way , Also through gradle Script , Type the class used for jump into a jar , As a API Services are provided to other modules as compile time dependencies (provided) introduce ;
- each library stay debug When you're in the middle of something apk , To package and run tests independently , At this time, there needs to be a startup Activity , and library It's not necessary , My idea is to put two AndroidManifest.xml , Use sourceSets Respectively in debug and release Load different AndroidManifest.xml.
about Android For developers , Plug in technology has been advanced Android One of the essential skills of a senior engineer . I have a copy of 【 senior Android Plug in enhanced combat 】 Information , I hope that helps !
#### Chapter one : The past and present of plug-in technology
1. Plug in feed
2. Plug in development history
Chapter two : Plug in principle
1. Class loading
2. Parental delegation mechanism
3. Resource loading
4. Four components support
5. ProxyActivity agent
6. hook The way
7. Other components
…
The third chapter :Android Preliminary study on plug-in
1. Implementing a plug-in framework from scratch ( On )
- Concept
- Plug in to solve the problem
- Comparison of plug-in frameworks
- Plug in implementation
- ClassLoader Implementation class
2. Implementing a plug-in framework from scratch ( in )
- Activity Startup process
- seek Hook spot
- The code stage
- Proxy object
- place a substitute by subterfuge , Replace the original Intent
- ActivityThread
Will act for intent Replace it with
…
3. Implementing a plug-in framework from scratch ( Next )
- Plug in resource loading
- Android Resource loading process in
- ActivityManager
- ActivityThread
- AppCompatActivity
- summary
Chapter four : Architecture evolution ( Big factory )
1. 360 Plug in development DroidPlugin
DroidPlugin yes 360 The mobile assistant is Android A new plug-in mechanism is implemented on the system . It can be installed without 、 Run with modifications APK file , This mechanism is helpful to improve the quality of large-scale APP The architecture of , There are some advantages in implementing multi team collaborative development .
2. sound of dripping water VirtualApk actual combat
VirtualAPK It's Didi 2017 year 6 Open source on a plug-in framework , Support Android Four components , And almost everything Android characteristic , adopt Gradle To build plug-ins , It's easy to integrate and build , It has been applied to Drops travel App On , Compatible with almost all of the Android equipment .
3. Analysis of the plug-in principle of iqiyi Neptune frame
Neptune Iqiyi mobile terminal is a set of flexible , Stable , Lightweight plug-in solution . After continuous research and development , Iteration and online verification , Now it's fully adapted Android P, It can dynamically load and run plug-ins on hundreds of millions of devices APK, For iqiyi many vertical business team to provide a stable service .
4. 360 Open source comprehensive plug-in framework RePlugin actual combat
RePlugin It's a complete set 、 The stability of the 、 Suitable for full use , Plug in scheme of occupying pits , from 360 Mobile phone guard's RePlugin Team Research and development , It is also the first proposal in the industry ” Full plug-in “( Comprehensive characteristics 、 Full compatibility 、 Full use ) The plan .
5. Tencent plug-in framework Shadow Project analysis
Shadow Is a Tencent independent research and development Android Plug in framework , It has been tested by hundreds of millions of online users .Shadow Not only open source shared the key code of plug-in technology , It also fully shares all the designs needed for online deployment . It has the function of independent installation App Source code 、 Zero reflection no Hack Implement plug-in technology 、 Full dynamic plug-in framework 、 Very small host increments 、Kotlin Support and so on .
Because of the long space , Quite a lot of details , Just show these for the time being ; Friends who need the full version of learning materials can Click here Free access !
Last
A good engineer , He should not only understand the principle , We have to learn to apply technology to practice , This is what a good programmer must have . If my article can help you , Then give me more support .