Development of Android plug-ins-analysis and preliminary exploration of android plug-ins

Source: Internet
Author: User

Development of Android plug-ins-analysis and preliminary exploration of android plug-ins

Undertake the aboveDevelopment of Android plug-ins-Basics
Http://blog.csdn.net/yzzst/article/details/45582315

By using DexClassLoader, We can dynamically load the classes in classes. dex into the current process. Of course, you can set some proxy interfaces in advance to complete the functions of the four major components.

Shows the overall function:

Of course, for an Android application, it is not enough to dynamically load the class and declare the four main components. As shown in, it is common to use an APK file to decompress the file content.

If you have developed an Android project, you will not be familiar with this directory, because it is very similar to the development environment when we develop Android applications. However, after all, the extracted files are not source code and cannot be directly read or modified. Each folder and file is described as follows:

-Assets sound, Font, webpage... resources,-org with third-party libraries, such as org. apache. the http library-com contains a third-party library. It does not explain the native library-armeabi. so file, c/c ++ code library file-META-INF APK signature file 【***. RSA ,***. SF ,***. MF files: the Resource Directory used in the res application-AndroidManifest. xml application attribute definition file-classes. dex Java source code compiled code file-resources. resource file compiled by arsc

This is the same for our plug-in installation. We can see from the directory that if we need to build a plug-in framework. In addition to using ClassDexLoader to parse and load classes. dex
We also need to solve several problems:

  • Plugin Signature Verification

  • Install native library to call Java Class and C/C ++.

  • Process AndroidManifest. xml and dynamically declare different components/permissions/broadcast/service/Theme

  • Store files such as ShreadPreference, SQLite, and cache

  • Plug-in uninstall

  • The host calls the plug-in function and calls back the code of the host.

  • Mutual function call between multiple plug-ins

Only after completing the above issues can we regard this framework as a reasonable plug-in framework, or it can be regarded as a process of dynamic Activity startup.

/*
* @ Author zhoushengtao (Zhou Shengtao)
* @ Since 14:02:22, January 1, January 27, 2015
* @ Weixin stchou_zst
* @ Blog http://blog.csdn.net/yzzst
* @ Exchange and learning QQ group: 341989536
* @ Private QQ: 445914891
/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.