return null;

}

4、在这个方法中,会去循环遍历dexElements,然后调用Element的findClass方法;那么这个dexElements是啥呢?在DexPathList构造方法中对其进行了赋值:

public DexPathList(ClassLoader definingContext, String dexPath,
String librarySearchPath, File optimizedDirectory) {
// save dexPath for BaseDexClassLoader
this.dexElements = makeDexElements(splitDexPath(dexPath), optimizedDirectory,
suppressedExceptions, definingContext);
}
5、splitDexPath --> splitPaths ,会返回一个List;
private static List splitPaths(String searchPath, boolean directoriesOnly) {
List result = new ArrayList<>();
if (searchPath != null) {
for (String path : searchPath.split(File.pathSeparator)) {
if (directoriesOnly) {
try {
StructStat sb = Libcore.os.stat(path);
if (!S_ISDIR(sb.st_mode)) {
continue;
}
} catch (ErrnoException ignored) {
continue;
}
}
result.add(new File(path));
}
}
return result;
}
6、makeDexElements方法会返回一个Element数组,可以看到在此方法中通过File构建DexFile,然后通过DexFile构建Element,最后将Elements数组返回:
private static Element[] makeDexElements(List files, File optimizedDirectory,
List suppressedExceptions, ClassLoader loader) {
Element[] elements = new Element[files.size()];
int elementsPos = 0;
/*
• Open all files and load the (direct or contained) dex files up front.
*/
for (File file : files) {
if (file.isDirectory()) {
// We support directories for looking up resources. Looking up resources in
// directories is useful for running libcore tests.
elements[elementsPos++] = new Element(file);
} else if (file.isFile()) {
String name = file.getName();
if (name.endsWith(DEX_SUFFIX)) {
// Raw dex file (not inside a zip/jar).
try {
DexFile dex = loadDexFile(file, optimizedDirectory, loader, elements);
if (dex != null) {
elements[elementsPos++] = new Element(dex, null);
}
} catch (IOException suppressed) {
System.logE("Unable to load dex file: " + file, suppressed);
suppressedExceptions.add(suppressed);
}
} else {
DexFile dex = null;
try {
dex = loadDexFile(file, optimizedDirectory, loader, elements);
} catch (IOException suppressed) {
/*
• IOException might get thrown “legitimately” by the DexFile constructor if
• the zip file turns out to be resource-only (that is, no classes.dex file
• in it).
• Let dex == null and hang on to the exception to add to the tea-leaves for
• when findClass returns null.
*/
suppressedExceptions.add(suppressed);
}
if (dex == null) {
elements[elementsPos++] = new Element(file);
} else {
elements[elementsPos++] = new Element(dex, file);
}
}
} else {
System.logW("ClassLoader referenced unknown path: " + file);
}
}
if (elementsPos != elements.length) {
elements = Arrays.copyOf(elements, elementsPos);
}
return elements;
}
7、现在我们知道了dexElements是啥了,我们回到步骤3,调用了Element的findClass
public Class<?> findClass(String name, ClassLoader definingContext,
List suppressed) {
 
   null; 
 
}
8、然后调用DexFile的loadClassBinaryName方法:
public Class loadClassBinaryName(String name, ClassLoader loader, List suppressed) {
return defineClass(name, loader, mCookie, this, suppressed);
}
9、接着会调用defineClass:
private static Class defineClass(String name, ClassLoader loader, Object cookie,
DexFile dexFile, List suppressed) {
Class result = null;
try {
result = defineClassNative(name, loader, cookie, dexFile);
} catch (NoClassDefFoundError e) {
if (suppressed != null) {
suppressed.add(e);
}
} catch (ClassNotFoundException e) {
if (suppressed != null) {
suppressed.add(e);
}
}
return result;
}
10、最后调用到Native方法defineClassNative:
private static native Class defineClassNative(String name, ClassLoader loader, Object cookie,
DexFile dexFile) throws ClassNotFoundException, NoClassDefFoundError;