From javadoc documentation:
usage: dx --dex [--debug] [--verbose] [--positions=<style>] [--no-locals] [--no-optimize] [--statistics] [--[no-]optimize-list=<file>] [--no-strict] [--keep-classes] [--output=<file>] [--dump-to=<file>] [--dump-width=<n>] [--dump-method=<name>[*]] [--verbose-dump] [--no-files] [--core-library] [--num-threads=<n>] [--incremental] [--force-jumbo] [--multi-dex [--main-dex-list=<file> [--minimal-main-dex]] [<file>.class | <file>.{zip,jar,apk} | <directory>] ... Convert a set of classfiles into a dex file, optionally embedded in a jar/zip. Output name must end with one of: .dex .jar .zip .apk or be a directory. Positions options: none, important, lines.\n --multi-dex: allows to generate several dex files if needed. This option is exclusive with --incremental, causes --num-threads to be ignored and only supports folder or archive output. --main-dex-list=<file>: <file> is a list of class file names, classes defined by those class files are put in classes.dex. --minimal-main-dex: only classes selected by --main-dex-list are to be put in the main dex.
dx is a tool that is used for dexing as part of the android build process. In build.xml (located in sdk.dir/tools/ant/buildxml ), which is used for the default build for android, it is used as part of the target name="-dex" declared in the dex-helper macro. It has deprecated Anttask , which still does not support --multi-dex.
From the dexer source code, the -main-dex-list options get the file input, which all class files that you want to be in the main dex, separated by a new line, have. Like this:
bin/classes/com/example/MainActivity.class
All other classes not declared in this list will go to secondary dex.
Or you can use the old path before --multi-dex introduced: http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
dieend
source share