Skip to content

Most visited

Recently visited

navigation

DexClassLoader

public class DexClassLoader
extends BaseDexClassLoader

java.lang.Object
   ↳ java.lang.ClassLoader
     ↳ dalvik.system.BaseDexClassLoader
       ↳ dalvik.system.DexClassLoader


A class loader that loads classes from .jar and .apk files containing a classes.dex entry. This can be used to execute code not installed as part of an application.

This class loader requires an application-private, writable directory to cache optimized classes. Use Context.getCodeCacheDir() to create such a directory:

   File dexOutputDir = context.getCodeCacheDir();
 

Do not cache optimized classes on external storage. External storage does not provide access controls necessary to protect your application from code injection attacks.

Summary

Public constructors

DexClassLoader(String dexPath, String optimizedDirectory, String librarySearchPath, ClassLoader parent)

Creates a DexClassLoader that finds interpreted and native code.

Inherited methods

From class dalvik.system.BaseDexClassLoader
From class java.lang.ClassLoader
From class java.lang.Object

Public constructors

DexClassLoader

added in API level 3
DexClassLoader (String dexPath, 
                String optimizedDirectory, 
                String librarySearchPath, 
                ClassLoader parent)

Creates a DexClassLoader that finds interpreted and native code. Interpreted classes are found in a set of DEX files contained in Jar or APK files.

The path lists are separated using the character specified by the path.separator system property, which defaults to :.

Parameters
dexPath String: the list of jar/apk files containing classes and resources, delimited by File.pathSeparator, which defaults to ":" on Android

optimizedDirectory String: this parameter is deprecated and has no effect

librarySearchPath String: the list of directories containing native libraries, delimited by File.pathSeparator; may be null

parent ClassLoader: the parent class loader

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)