Android knowledge points finishing (3)

"Android Advanced Advanced" study notes
first three lessons learned papers


Chapter 21: Principles and Solutions of 64K Method Limits

  The "64K method count problem" means that the number of Java method references in the Android Dalvik executable file .dxe exceeds 65535.

1. Reasons for 64K limit

  The Android APK file is essentially a compressed file. The classes.dex file contained in it is an executable Dalvik bytecode file. The .dex file stores all the compiled Java code. The Dalvik executable file specification limits the maximum number of methods that a single .dex file can reference to 65,535, which includes the Android Framework, third-party function libraries referenced by the APP, and the APP's own methods.

2. Use MultiDex to solve the 64K limit problem

  Before Android 5.0 (API Level 21), the system used the Dalvik virtual machine to execute Android applications. In order to avoid the problem that the number of methods in a single .dex file exceeds 64K, it is necessary to split a single classes.dex file into multiple .dex files. Google provides the MultiDex Support Library function library.

  After Android 5.0, the system uses the ART (Android runtime) virtual machine instead of the Dalvik virtual machine, and the ART virtual machine supports loading multiple .dex files from APK files. During the application installation, it will perform a pre-compilation (AOT, Ahead-Of-Time) operation, scan all the .dex files in the APK, and compile them into an .oat file, and load the .oat file when the application is running .

Chapter 22: Research and Practice of Android Plug-in Framework Mechanism

  The basic form of the plug-in framework is to split the different functional modules in an APK and divide them into different .dex files or APK files. The main project is just an empty shell and provides a framework for loading modules dex or APK. .

Chapter 23: Detailed Principles of Push Mechanism Implementation

  • Pull mode: APP actively initiates a Request request to the server; a short connection is maintained between the mobile terminal and the server, that is, a connection is requested when needed, and the connection is disconnected after obtaining data.
  • Push mode: The server actively sends messages to the mobile terminal; the mobile terminal and the server maintain a long connection.

Chapter 24: APP slimming experience summary

  The META-INF folder stores signature-related information, which is used to verify the integrity of the APK package and ensure the security of the system. It mainly includes three files:

  1. MANIFEST.MF: Mainly stores the name of each file in the APK package and the SHA1 hash value of each file.
  2. CERT.SF: Usually each APP has a specific name, which stores the hash value of MANIFEST.MF and the hash value of each hash item in the MANIFEST.MF file.
  3. CERT.RSA: Save the signature of the APK package and the public key information of the certificate.

Chapter 25: Principles and Practice of Android Crash Log Collection

  The bottom layer of Android is built on the Linux operating system, the upper layer is implemented based on the Java language, and the communication between the upper layer and the bottom layer is based on JNI. Therefore, to develop on Android, it is inevitable to deal with Java and C/C++.

  Correspondingly, Crash may occur in these two layers. Java runs on a virtual machine, while C/C++ is closer to the operating system. The Crash mechanism of these two layers is quite different.

Guess you like

Origin blog.csdn.net/michael_f2008/article/details/77935572