Struct droid_wrap::dalvik::system::DexClassLoader
source · pub struct DexClassLoader { /* private fields */ }Expand description
- 类加载器,用于从包含 classes.dex 条目的 .jar 和 .apk 文件中加载类。这可用于执行未作为应用程序的一部分安装的代码。
- 在 API 级别 26 之前,此类加载器需要一个应用程序私有的可写目录来缓存优化的类。使用 Context.getCodeCacheDir() 创建这样的目录:
- File dexOutputDir = context.getCodeCacheDir();
- 不要在外部存储上缓存优化的类。外部存储不提供保护应用程序免受代码注入攻击所需的访问控制。
Implementations§
source§impl DexClassLoader
impl DexClassLoader
sourcepub fn new(
dex_path: String,
optimized_directory: String,
library_search_path: String,
parent: &ClassLoader,
) -> Self
pub fn new( dex_path: String, optimized_directory: String, library_search_path: String, parent: &ClassLoader, ) -> Self
- 创建 DexClassLoader,用于查找解释代码和本机代码。解释类位于 Jar 或 APK 文件中包含的一组 DEX 文件中。路径列表使用 path.separator 系统属性指定的字符分隔,默认为 :。
dex_path包含类和资源的 jar/apk 文件列表,由 File.pathSeparator 分隔,在 Android 上默认为“:”optimized_directory此参数已弃用,自 API 级别 26 起无效。library_search_path包含本机库的目录列表,由 File.pathSeparator 分隔;可能为 nullparent父类加载器
Methods from Deref<Target = GlobalRef>§
Methods from Deref<Target = JObject<'static>>§
Trait Implementations§
source§impl Debug for DexClassLoader
impl Debug for DexClassLoader
source§impl Deref for DexClassLoader
impl Deref for DexClassLoader
source§impl From<&GlobalRef> for DexClassLoader
impl From<&GlobalRef> for DexClassLoader
source§impl Into<GlobalRef> for &DexClassLoader
impl Into<GlobalRef> for &DexClassLoader
source§impl JObjNew for DexClassLoader
impl JObjNew for DexClassLoader
source§impl JType for DexClassLoader
impl JType for DexClassLoader
Auto Trait Implementations§
impl Freeze for DexClassLoader
impl RefUnwindSafe for DexClassLoader
impl Send for DexClassLoader
impl Sync for DexClassLoader
impl Unpin for DexClassLoader
impl UnwindSafe for DexClassLoader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more