ClassLoader and Android classloader
I don't like General talk about those metaphysical principles, or remember those established things. People who rely on memories to make up for thinking are easy to fall into the cloud of people. In the end, they will be trapped by memories, and creativity will eventually die out. I hope this series of experts will record my learning about Android. Thus, the stream is merged into the river and becomes the sea.
Next we will analyze the ClassLoader in combination with the code.
An android application is a Dalvik virtual machine that Loads files in Dex format. Loading files in Dex format is what ClassLoader does. So, let's start with the application, because the startup of the application must be inseparable from the ClassLoader.
Let's talk about how to start an application. In "Application of the path to Android", Process is analyzed from the application level. start method. to start an activity, call the start method of Process. The start method of Process is the method of Zygote. Here, the process is clear. The following process appears a little round-robin, Because java on Android is different from other java, and every android application is a process. In order to realize the ideal of one application and one Virtual Machine [this ideal satisfies the possibility that the application can be well protected from interference by other applications, it's just a waste of such effort to protect the data of applications from being infringed by other applications. We can see how much effort google has paid for application security... Google has made a lot of effort on this, so we must thoroughly understand the security mechanisms configured by google in the future ]. The JVM security model is not suitable for mobile phones. Permission management is a big topic, but there are actually two types:
1. protection during the execution period: ensure that the java code being executed is correct and is not infringed.
2. Data protection: Protection against malicious data infringement.
1. First, protection during the execution period. The security features of the class loading architecture, class file validators, and Java virtual machines (and languages) share the same purpose: maintains the internal integrity of Java Virtual Machine instances and running applications so that they are not compromised by malicious or vulnerable code.
2. Second, data protection. Android has its own data protection method. It is a digital signature, similar to qq login.
Obviously, the first protection has a lot to do with this ClassLoader. The second type of protection is more or less related to ClassLoader, because the dex file in the apk file is also a type of private data.
In addition, the classloader of Android is different from the classloader of java. So we have to analyze the code. What is classloader? How does this mysterious God affect permissions?
Tired, typing is really hard. Rest. Continue tomorrow. Start with zygote.
How to release Android ListView after it is loaded by system class loader
I am looking forward to the answer to a profound question.
JavalangClassNotFoundException dalviksystemPathClassLoader for Android Development
On android, if the program restarts due to a serious error during code execution, ClassNotFoundException will be encountered. check whether this situation exists!