Http://www.cnblogs.com/android-blogs/p/5703355.html what is modular and plug-in?
Component Development is to divide an app into modules, each of which is a component (module), and we can make these components dependent on each other or debug parts of the components individually, but when they are finally released, they are consolidated into an APK, This is the development of components.
plug-in development and component development slightly unused, plug-in development when the entire app is split into a number of modules, which include a host and multiple plug-ins, each module is an APK (modular each module is a lib), The host apk and plug-in APK are packaged separately or in combination when you finally pack.
Overview of components
Android engineering components are generally divided into two types, LIB components and application components
Application component means that the component itself can be run and packaged into an APK
A Lib component is a component that is part of the app and can be used by other components but cannot be packaged as an APK
Why do you have to be modular?
Join an app project only one component, as the app business grows more and more modules, the code volume of over 100,000 is very normal, this time we will encounter the following issues
- A little bit of code to change a module to compile the entire project, time-consuming power
- Public resources, business, modules mixed together too high coupling degree
- Not easy to test
Assembly of the correct posture
Now that you have chosen to use the component, how do you use it correctly? Here is a solution, if you have a better solution, welcome to communicate.
We created an app project, and by default there is an app component that can be run directly.
How do you divide components?
- 1. Create a new Lib component, new Module->andorid Library, named Baseutillib, we put all the common tools, network, etc.
- 2. Create a new Lib component, Baseresllib, we put all the public resources, drawable, strings and other classes in it
- 3. The app is divided into several modules according to its own rules, such as by business by region, etc.
- 4. Develop a module one by one, such as the test module, create a new TestApp component, and the TestApp component references the baseutillib and baseresllib of the [] step, adding and referencing the TestApp component in the Testlib component. Write code to write business logic in testlib activity, TestApp is only responsible for jumping and testing
- 5. Introduce all similar testlib components in the project (not TestApp components) into the engineering app
Look a little messy, sort out a picture
The benefits of this are
Each module can be independently developed and compiled to run
Resource and tool classes can be shared when developing a single module
Can be tested against a single module
Demo Address: Https://github.com/halibobo/ModuleBuild
Why plugins are plugins?
With the component, why use plug-in? Plug-in development generally has the following advantages (different from the plugin framework):
- Host and plugin compile separately
- Concurrent development
- Dynamic Update Plugin
- Download modules on Demand
- The number of methods or the number of variables is bursting
Situation
Open plug-in development framework is more, they each have their own advantages and shortcomings, the realization of the principle there are differences in the following columns
Open source plug-in framework
- Qihoo360/droidplugin
- ctripmobile/dynamicapk
- Mmin18/androiddynamicloader
- singwhatiwanna/dynamic-load-apk
- Houkx/android-pluginmgr
- Bunnyblue/acdd
- Wequick/small
- ......
Currently open source of these frameworks have the host and plug-ins separated also have a blend of, each frame detailed introduction and demo can be seen in GitHub. Plug-in demo run is relatively simple, but really use it in the actual project or to consider a lot of small details, I am currently in the research stage.
Turn from: Big Black
Android Modular and plug-in development