Android dynamically loading those things

Source: Internet
Author: User

Basic1.Java class Loader

The ClassLoader (class loader) is a very important concept in Java. The ClassLoader is responsible for loading the Java class's byte code into the Java virtual machine. In this paper, the basic concepts of Java ClassLoader are introduced in detail, including the proxy mode, the concrete process of loading class and the thread context class loader, and then how to develop your own classloader, and finally introduce the application of ClassLoader in Web container and OSGi.

2. Principle of Reflection

The reflector system provided by Java allows you to load classes, to examine the type of information, to generate objects, or to create objects generated by a reflection system, which is a method hint or a kind of visual tool that is provided in an integrated development environment, as in the case of JavaBean in a JSP. Self-Collection requests information is also used for reflection, and some software development frameworks (the framework) are also commonly seen in the use of reflectors to achieve the purpose of moving users to the user's own category.

3. Proxy mode and Java implementation Dynamic Agent

Definition: Provides a proxy object for an object, and the proxy object Controls access to the original object, that is, the client does not manipulate the original object directly, but indirectly manipulates the original object through the proxy object.

Getting StartedResearch on 1.Android dynamic load Dex Technology

Android uses the Dalvik virtual machine to load the executable program, so the class-based jar cannot be loaded directly, instead it needs to be converted to Dex bytecode to execute the code. Optimized bytecode files can exist in a *.jar, as long as their internal storage is *.dex can be used.

Getting Started with 2.Android plug-ins

The developer encapsulates the plugin code into a jar or apk. The host downloads or loads the jar or apk from the local to the host. Use the algorithm in the plugin or Android-specific class (such as activity) for the host

3. Plug-in development-dynamic loading technology load installed and not installed APK

The dynamic loading technique is to use the ClassLoader to load the appropriate apk, Dex, JAR (which must contain the Dex file), and then get the APK, Dex, the inside of the Jar (class, picture, color, and so on) for use by the host app.

4.Android Dynamic Loading technology three key questions

Dynamic load technology (also known as plug-in technology) plays a significant role in technology-driven companies, and when projects become larger, they need to be plugged in to ease the memory and CPU usage of the application, and can be hot-swappable, i.e. updating some modules without releasing a new version.

Advanced1. Ctrip Android App plugin and dynamic loading practice

Ctrip's Android app's plug-in and dynamic loading framework has been on the go for half a year and has undergone initial exploration and continuous polishing, and the new framework and engineering configuration have withstood the test of production practice. This article will detail the principles and implementation details of the Android platform plug-in development and dynamic loading technology, review the architecture evolution of Ctrip's Android app, and expect our experience to help more Android engineers.

2. Dynamic load apk principle sharing

The loaded apk is called a plugin because the mechanism is similar to biological "parasitic", and the application that loads the plugin is also called the host. Often not all apk can be loaded as plug-ins, often need to follow certain "development specifications", but also need plug-in projects to introduce some kind of API class library, the industry usually do.

A realization of 3.Android plug-in

Android plug-in is a commonplace topic, plug-in benefits are many: de-code coupling, plug-in support hot plug, silent upgrade, fundamentally solve 65K properties and methods of the bug and so on. Let us introduce the CFD framework we are using. This film is mainly in the way of class diagram to introduce the implementation of the plug-in speech framework.

4. Modular Road of Mushroom Street APP

With the booming of my street business, the demand for new functions and products is becoming more and more intense, and it is often possible to hear "there is a function I would like to have on week x, OK". Are you okay? Of course, the new features have to be issued a new version of Ah, time-consuming and laborious to disrupt the development rhythm does not say, coverage is also a problem.

5.DYNAMICLOADAPK Source Code Analysis

DYNAMICLOADAPK is an open source Android plugin framework. The advantages of the plug-in include: (1) module decoupling, (2) dynamic upgrade, (3) Efficient parallel development (faster compilation Speed) (4) on-demand loading, lower memory consumption, etc. dynamicloadapk provides 3 development methods that enable developers to quickly integrate plug-in functionality without having to understand how it works.

Research on dynamic loading mechanism of 6.Android apk

The problem is this: we know that the APK must be installed to run, and if not installed it would be nice to be able to run it, in fact, it's not entirely impossible, although it's harder to implement. On the theoretical level, we can run some of the unused apk from a host program, but it can also be implemented on a practical level, but this is required for the APK that is not installed. Our idea is this, first of all to understand that the APK is not installed can not be directly tuned up.

7. Android Dex automatic unpacking and dynamic loading introduction

As an Android developer, in the development of the application, as the size of the business to a certain extent, and constantly add new features, adding new class library, the code is rapidly expanding, the corresponding APK package size also increased sharply, then one day, you will unfortunately encounter this error.

8. TripAdvisor's original Android app plugin implementation

The plugin for TripAdvisor is based on dynamic-load-apk (GitHub). Defines the way that hosts and plug-ins communicate, so that they can each other's pages and invoke each other's functions. At the same time, the activation mode of activity is singletask and so on, and the support of service is added. In short, plug-in development to maximize the maintenance of the original Android development habits.

9. Android apk resource loading and activity lifecycle management

Bloggers analyzed the dynamic loading mechanism of apk in Android, and at the end of the article pointed out two complex problems that need to be solved: resource access and Activity lifecycle management, and this article will analyze the solution of these two complex problems.

10.APK dynamic load Frame (DL) parsing

The first thing to say is that the dynamic loading technology (or plug-in) plays a very important role in a technology-driven company, and when the project gets bigger, it needs to be plugged in to ease the memory and CPU usage of the application, and it can be hot-swappable to update some modules without releasing a new version.

Series1.Kaedea---an easy-to-understand introduction to Android dynamic loading technology

We started using dynamic loading technology in Android projects early on, primarily to achieve the ability to upgrade applications without reinstalling the APK (especially the SDK Project), which would greatly increase the coverage of the new version of the application and reduce the pressure on the server to be compatible with older versions of the interface. Also, if you can quickly fix some online bugs.

2.Kaedea---android dynamic load base ClassLoader working mechanism

Early adopters of Java-written software such as Eclipse may be familiar, and Eclipse can load many third-party plug-ins (or extensions), which is dynamic loading. Most of these plug-ins are jar packages, and the use of plug-ins is to dynamically load the class in the jar package to work.

3.Kaedea---android dynamic load Supplement load SD card so library

The use of JNI in Android actually includes dynamic loading, which is loaded dynamically when the app is running. So library and call its encapsulated method through JNI. The latter is typically compiled from C/+ + code using the NDK tool, which runs on the native layer, which is much more efficient than executing Java code in the virtual machine, so it is often done dynamically by loading the. So library to perform some work that requires performance comparisons (such as T9 search, or bitmap decoding, image Gaussian blur processing, etc.).

4.Kaedea---Android dynamic load Getting started simple load mode

In a Java program, the JVM virtual machine is loaded by the class loader classloader the class inside the. jar file. Android is similar, but Android uses a dalvik/art virtual machine, not a JVM, and cannot load the. jar file directly, but instead loads the Dex file.

5.Kaedea---Android dynamic loading advanced agent activity mode

In simple mode, using ClassLoader to load external dex or APK files, you can load some classes that do not exist on the local app to execute some new code logic. However, using this method does not directly activate the activity in the plugin.

6.Kaedea---android dynamic loading black technology dynamically create activity mode

Remember that we talked about the two challenges of activating the activity in the plugin apk in agent activity mode, because the activity in the plugin was not registered in the manifest of the main project, so we couldn't go through a series of initialization processes at the system framework level. The resulting activity instance does not have a life cycle and cannot use res resources.

7. Nicholas---Plugin development basics: Dynamic Loading technology interpretation

In the current hardware and software environment, Native app and web app have obvious advantages in user experience, but in the actual project some will frequently upgrade the client because of frequent business changes, resulting in poor user experience, and this is precisely the advantage of web App. This article combs and practices the data of the dynamic loading jar of Android on-line here to share with you, trying to improve the disadvantage of frequent upgrade.

8. Nicholas---Plugin development begins: ClassLoader analysis

This article focuses on the main two classloader in Android: Pathclassloader and Dexclassloader, their differences, connections, usage issues, and what common problems we encounter in the process of making plugins. This article is also the basis for the following two articles, because if you do not know these two classes, we will not be able to do the following.

9. Nicholas---Plugin development medium: Resource loading problem (skin-changing principle analysis)

This article mainly through some of the application of the skin-changing technology to see, in the process of developing plug-ins How to solve some of the problem of resource loading, this question why to separate out to explain, because he is involved in a lot of knowledge, but also the basis of a later article, we need to load the resource files in the plugin.

10. Nicholas---Plugin development ultimate: Dynamic load activity (free install run program)

This article mainly explains how to load the activity in the plugin. This allows for installation-free operation, and this article is a comprehensive use of the knowledge of the first three articles. Many applications will use plug-in technology, because the size of the package and the priority of some features to determine which modules can be made into plug-ins.

11.Weishu---Android plug-in principle analysis--Overview

Classes can be loaded using Java's classloader mechanism, but for Android, it's not that class loading comes in, many components have "life", so for these flesh-and-blood classes, they must be energized, which is called Component Lifecycle management.

12.Weishu---Android plug-in principle analysis--hook mechanism of dynamic agent

Using the proxy mechanism for API hooks to achieve method enhancement is a common means of the framework, such as the Java Framework Spring through the dynamic agent elegant implementation of AOP programming, greatly improving the efficiency of web development; The plug-in framework also uses a wide range of proxy mechanisms to enhance the system API to achieve plug-in purposes.

13.Weishu---Android plug-in principle analysis--hook mechanism of binder Hook

The Android system provides a series of system services to the application through the binder mechanism, such as Activitymanagerservice,clipboardmanager, Audiomanager, etc. These ubiquitous system services provide applications with exceptionally powerful functions such as task management, audio, and video.

14.Weishu---Android plug-in principle analysis--hook mechanism Ams&pms

In the previous article we introduced the hook mechanism of droidplugin, which is the proxy mode and binder hook, and the plug-in framework realizes the transparency of plug-in usage and development through AOP. Before describing how Droidplugin can implement the four-component plug-in, it is important to explain how it hooks up to AMs and PMS.

15.Weishu---Android plug-in principle analysis--activity life cycle Management

Before the Android plug-in principle Analysis series of the article opened the hook mechanism of the mystery, now we hold the Sky Dragon Slayer, then how to complete the plug-in solution through this technology? Specifically, how do components such as Activity,service in the plugin run on the Android system?

16.Weishu---Android plug-in principle analysis-plug-in loading mechanism

In activity lifecycle management above, we have completed the task of "initiating activity that is not explicitly declared in Androidmanifest.xml"; AMS and Intercept Activitythread class H for component scheduling we have successfully bypassed the androidmanifest.xml limit.

Class Library1.Small

The world is so big and the components are so small. Small, make the most lightweight cross-platform plug-in framework. There's a very detailed document in it.

2.android-plugin-framework

This project is the complete source code and example of the Android plugin development framework. Used to run the plug-in APK in the host program in a dynamically loaded manner.

3.DynamicAPK

Implement Android app apk plugin and dynamic load, support resource subcontracting and hot fix. The plugin and dynamic loading framework of Ctrip app.

4.DroidPlugin

It's 360. Mobile Assistant implements a new plug-in mechanism on Android system

5.android-pluginmgr

APK dynamic loading framework is not required for plug-in specifications.

6.dynamic-load-apk

Android uses dynamic loading framework DL for plug-in development

7.AndroidDynamicLoader

Android Dynamic Loading framework, he does not use agent Activity in the way of implementation but with Fragment and Schema of the way to achieve

8.ACDD

Non-agent Android dynamic deployment framework

Reference video

1.android plug-in and dynamic deployment

Ali Technology Salon 16th Edition "Android plug-in and dynamic Deployment" video

Android dynamically loading those things

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.