绥化市网站建设_网站建设公司_搜索功能_seo优化
2025/12/31 19:08:40 网站建设 项目流程

源码阅读:类加载器--DexPathList

DexPathList 是在Android环境中用来加载dex文件以及native库的

构造方法

DexPathList(ClassLoader definingContext, String dexPath,String librarySearchPath, File optimizedDirectory, boolean isTrusted) {if (definingContext == null) {throw new NullPointerException("definingContext == null");}if (dexPath == null) {throw new NullPointerException("dexPath == null");}if (optimizedDirectory != null) {if (!optimizedDirectory.exists())  {throw new IllegalArgumentException("optimizedDirectory doesn't exist: "+ optimizedDirectory);}if (!(optimizedDirectory.canRead()&& optimizedDirectory.canWrite())) {throw new IllegalArgumentException("optimizedDirectory not readable/writable: "+ optimizedDirectory);}}this.definingContext = definingContext;ArrayList<IOException> suppressedExceptions = new ArrayList<IOException>();// save dexPath for BaseDexClassLoaderthis.dexElements = makeDexElements(splitDexPath(dexPath), optimizedDirectory,suppressedExceptions, definingContext, isTrusted);// Native libraries may exist in both the system and// application library paths, and we use this search order:////   1. This class loader's library path for application libraries (librarySearchPath)://   1.1. Native library directories//   1.2. Path to libraries in apk-files//   2. The VM's library path from the system property for system libraries//      also known as java.library.path//// This order was reversed prior to Gingerbread; see http://b/2933456.this.nativeLibraryDirectories = splitPaths(librarySearchPath, false);this.systemNativeLibraryDirectories =splitPaths(System.getProperty("java.library.path"), true);this.nativeLibraryPathElements = makePathElements(getAllNativeLibraryDirectories());if (suppressedExceptions.size() > 0) {this.dexElementsSuppressedExceptions =suppressedExceptions.toArray(new IOException[suppressedExceptions.size()]);} else {dexElementsSuppressedExceptions = null;}}

构造方法中的操作:

1.将dex文件目录进行解析并保存

2.将系统中native目录进行保存

2.将所有的native存储的so文件封装成element[]进行保存

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询