FileDocCategorySizeDatePackage
MainDexListTest.javaAPI DocAndroid 5.1 API1955Thu Mar 12 22:18:30 GMT 2015com.android.dx.multidex

MainDexListTest

public final class MainDexListTest extends Object
Test that DexMerge works by merging dex files, and then loading them into the current VM.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        // simplify the javac classpath by not depending directly on 'dalvik.system' classes
        ClassLoader mainLoader = (ClassLoader) Class.forName("dalvik.system.PathClassLoader")
                .getConstructor(String.class, ClassLoader.class)
                .newInstance("out/classes.dex", MainDexListTest.class.getClassLoader());
        ClassLoader secondaryLoader = (ClassLoader) Class.forName("dalvik.system.PathClassLoader")
                .getConstructor(String.class, ClassLoader.class)
                .newInstance("out/classes2.dex", MainDexListTest.class.getClassLoader());

        mainLoader.loadClass("testdata.InMainDex");
        secondaryLoader.loadClass("testdata.InSecondaryDex");
       try {
           secondaryLoader.loadClass("testdata.InMainDex");
           throw new AssertionError();
       } catch (ClassNotFoundException e) {
           // expected
       }
       try {
           mainLoader.loadClass("testdata.InSecondaryDex");
           throw new AssertionError();
       } catch (ClassNotFoundException e) {
           // expected
       }