Android hot fix (a)

noun:

dex: java class files are compiled and then generate dex files running on Android;

1.dex subcontractors;

dex file 2. Identify problems of replacement operation

3. Download the file dex, silent replace problematic dex file, make changes

Detailed hot fixes:

1. Make sure that the file is the main class, not a problem of class;

2. Multi subcontractors;

3. Download dex files;

4. This written and injected;

 

Second, the injection explain:

After the completion of the installation package 1.apk storage path: data / app / pacageName-1 / base.apk have sub-file classes.dex classes2.dex

 using java class loader ClassLoader

 Android use ClassLoader subclass to load: BaseDexClassLoader load file Dex

 BaseDexLoader loader source code analysis:

 it's inside

   DexPathList{

       Elements[]

       makeDexElements // This method returns an array of file Dex

  }

 Method: makeDexElements: Elements [] is the number of put file Dex

 Load principle:

 First find the first file to run Dex, Dex when MainActivity call other documents,

 Elements will go from there, if not it will throw an exception: File not found

 Elements PathList BaseDexClassLoader acquiring system by reflection;

 Elements PathList get the latest reflection of Dex by BaseDexClassLoader;

 Recombinant array: Remember: Latest Dex put at the head;

 Elements of the system is provided

 

 

 

 

       

 

   

 

Guess you like

Origin www.cnblogs.com/huihuizhang/p/11210835.html