Added in API level 26

InMemoryDexClassLoader

public final class InMemoryDexClassLoader
extends BaseDexClassLoader

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


A ClassLoader implementation that loads classes from a buffer containing a DEX file. This can be used to execute code that has not been written to the local file system.

Summary

Public constructors

InMemoryDexClassLoader(ByteBuffer dexBuffer, ClassLoader parent)

Creates a new in-memory DEX class loader.

InMemoryDexClassLoader(ByteBuffer[] dexBuffers, ClassLoader parent)

Create an in-memory DEX class loader with the given dex buffers.

InMemoryDexClassLoader(ByteBuffer[] dexBuffers, String librarySearchPath, ClassLoader parent)

Create an in-memory DEX class loader with the given dex buffers.

Inherited methods

Public constructors

InMemoryDexClassLoader

Added in API level 26
public InMemoryDexClassLoader (ByteBuffer dexBuffer, 
                ClassLoader parent)

Creates a new in-memory DEX class loader.

Parameters
dexBuffer ByteBuffer: buffer containing DEX file contents between buffer.position() and buffer.limit(). This value cannot be null.

parent ClassLoader: the parent class loader for delegation. This value may be null.

InMemoryDexClassLoader

Added in API level 27
public InMemoryDexClassLoader (ByteBuffer[] dexBuffers, 
                ClassLoader parent)

Create an in-memory DEX class loader with the given dex buffers.

Parameters
dexBuffers ByteBuffer: array of buffers containing DEX files between buffer.position() and buffer.limit(). This value cannot be null.

parent ClassLoader: the parent class loader for delegation. This value may be null.

InMemoryDexClassLoader

Added in API level 29
public InMemoryDexClassLoader (ByteBuffer[] dexBuffers, 
                String librarySearchPath, 
                ClassLoader parent)

Create an in-memory DEX class loader with the given dex buffers.

Parameters
dexBuffers ByteBuffer: array of buffers containing DEX files between buffer.position() and buffer.limit(). This value cannot be null.

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

parent ClassLoader: the parent class loader for delegation. This value may be null.