MultiDex
public final class MultiDex
extends Object
Monkey patches the application context class loader
in order to load classes from more than one dex file. The primary classes.dex
must contain the classes necessary for calling this class methods. Secondary dex files named classes2.dex, classes3.dex... found in the application apk will be added to the classloader after first call to install(Context)
.
This library provides compatibility for platforms with API level 4 through 20. This library does nothing on newer versions of the platform which provide built-in support for secondary dex files.
Summary
Public methods |
static void |
install(Context context) Patches the application context class loader by appending extra dex files loaded from the application apk. |
Inherited methods |
From class java.lang.Object
Object |
clone() Creates and returns a copy of this object. |
boolean |
equals(Object obj) Indicates whether some other object is "equal to" this one. |
void |
finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
final Class<?> |
getClass() Returns the runtime class of this Object . |
int |
hashCode() Returns a hash code value for the object. |
final void |
notify() Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() Wakes up all threads that are waiting on this object's monitor. |
String |
toString() Returns a string representation of the object. |
final void |
wait(long millis, int nanos) Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
final void |
wait(long millis) Causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
final void |
wait() Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
|
Public methods
install
void install (Context context)
Patches the application context class loader by appending extra dex files loaded from the application apk. This method should be called in the attachBaseContext of your Application
, see MultiDexApplication
for more explanation and an example.
Parameters |
context |
Context : application context. |
Throws |
RuntimeException |
if an error occurred preventing the classloader extension. |