1:序言
深入理解插件化-Dalvik虚拟机对Dex的加载过程(一)
Java层的dex加载可以先看下这个,这篇文章主要说Native层的加载
2:DexFile
路径:\libcore\dalvik\src\main\java\dalvik\system/DexFile
public DexFile(String fileName) throws IOException {
mCookie = openDexFile(fileName, null, 0);
mFileName = fileName;
guard.open("close");
//System.out.println("DEX FILE cookie is " + mCookie);
}
3:openDexFile
/*
* Open a DEX file. The value returned is a magic VM cookie. On
* failure, an IOException is thrown.
*/
private static int openDexFile(String sourceName, String outputName,
int flags) throws IOException {
return openDexFileNative(new File(sourceName).getCanonicalPath(),
(outputName == null) ? null : new File(outputName).getCanonicalPath(),
flags);
}
openDexFileNative
路径:\dalvik\vm\native\dalvik_system_DexFile.cpp