JNI/NDK Development Guide (2), jnindk
1. Generate the dynamic library. so and store it in the system/lib/of the mobile phone. (How does the APP store. so in this directory ?????), When the Java layer calls the JNI class, the static code System. loadLibrary ("***") is executed to load the dynamic library in the system/lib directory of the mobile phone to the VM.
2. In the so dynamic library, the C component developer initializes through the JNI_OnUnload () function. Of course, the old version of JNI does not have the JNI_OnUnload () function, so the VM can determine whether JNI is a new version or an old version based on the function.
3. The JNI_OnUnload () function can also register various local functions provided by. so (what kind of registration process ???) To VM to accelerate the efficiency of subsequent calls to local functions.
4. as in loading. so calls JNI_OnLoad () immediately to initialize the component. When the VM releases the C component, it also calls the JNI_OnUnload () function for cleanup.
5. my personal understanding about JNIEnv: for example, if an object of the same class is created in multiple threads and the native method of the object is called, a parameter JNIEnv is passed to the native method, indicates the environment in which the native method runs, that is, the thread in which the native method runs.