Android plug-in Development Summary and overview, android plug-in
I have just finished writing the last article on plug-in development. The following is a summary of the plug-ins in Android that have been planned since July November, this article mainly explains the plugin development principles in Android from three aspects. To put it bluntly, the principle of plug-in development is: dynamic loading technology. However, we may encounter many problems during the development of plug-ins. Therefore, this article is divided into three articles for explanation and is also a step-by-step process, solved the problems that may be encountered during plug-in development, but the basics of these three articles are dynamic loading technology.
1. Plug-in development basics: Explanation of dynamic loading technology
Http://blog.csdn.net/jiangwei0910410003/article/details/17679823
This article mainly introduces the DexClassLoader class function in Android, and explains how to use the dynamic loading technology and why to use the dynamic loading technology. At the very beginning, we use this class to strip functional modules and place some modules in the specified jar/dex/apk and then dynamically load them. The advantage of this is to reduce the package size, more flexible features.
Technical point: DexClassLoader source code interpretation, use
2. Plug-in Development Opening: Class Loader Analysis
Http://blog.csdn.net/jiangwei0910410003/article/details/41384667
This article mainly introduces two main class loaders in Android: PathClassLoader and DexClassLoader. Their differences, connections, usage, and other issues, and the common problems we encounter when creating the plug-in. This article is also the basis of the two subsequent articles, because if we do not understand these two classes, we will not be able to perform subsequent operations.
Technical point: the source code of the PathClassLoader class and the DexClassLoader class are interpreted, but they are not associated with each other.
Third, plug-in development: Resource Loading Problems (skin swap Principle Analysis)
Http://blog.csdn.net/jiangwei0910410003/article/details/47679843
This article mainly explains how to solve some resource loading problems during the development of plug-ins by interpreting some of the skin-changing technologies that come with applications, this is because he has a lot of knowledge and is also the basis of the next article. When we need to load the resource files in the plug-in. How to handle the changes. I have made a detailed explanation here. At the same time, with this technology, we can achieve skin-changing development of applications.
Technical point: Dynamic Resource loading, source code interpretation of the AssetManager class
Fourth, plug-in development ultimate article: dynamic loading Activity (without installing and running programs)
Http://blog.csdn.net/jiangwei0910410003/article/details/48104455
This article mainly explains how to load the Activity in the plug-in. To avoid installation and running of programs, this article is also a comprehensive use of the knowledge of the first three articles. The plug-in technology is used for downloading many applications, because the package size and the priority of some functions determine which modules can be used as plug-ins. This article also introduces two ways to dynamically load Activity. These two methods have their own advantages and disadvantages.
Technical point: loading Activity, LoadedApk class and ActivityThread class source code in two ways
Summary
The dynamic loading technology in Android is very delicious. When I first came into contact with this technology, it happened that I graduated from college in 2013. At that time, we needed to implement the aggregation advertisement SDK, so we needed to process various advertisements and use the dynamic loading technology to load the sdks of various advertisements. The first time I got started with dynamic loading, I was very excited because of my feeling. The code can also be written in this way. The feature is stripped so well. So I am very obsessed with this technology. Later, I started to study plug-in Development Technology in depth just because of my personal interest. Of course, the essence is dynamic loading, but a specific problem needs to be solved. Now there are also some frameworks written by Daniel. I personally think the best is the framework written by this Buddy:
Https://github.com/Qihoo360/DroidPlugin
Haha, the name is 360. Well, the 360 companies that have to admire Chinese technology research can be regarded as awesome.
Of course, I believe that with the passage of time, there will certainly be more cool people studying this technology and developing a more complete framework. I am very much looking forward to it.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.