DexOptions

DSL object for configuring dx options.

Properties

PropertyDescription
additionalParameters

List of additional parameters to be passed to dx.

javaMaxHeapSize

Specifies the -Xmx value when calling dx. Example value is "2048m".

jumboMode

Enable jumbo mode in dx (--force-jumbo).

keepRuntimeAnnotatedClasses

Keep all classes with runtime annotations in the main dex in legacy multidex.

maxProcessCount

The maximum number of concurrent processes that can be used to dex. Defaults to 4.

optimize

Whether to run the dx compiler with the --no-optimize flag.

preDexLibraries

Whether to pre-dex libraries. This can improve incremental builds, but clean builds may be slower.

threadCount

Number of threads to use when running dx. Defaults to 4.

Methods

No methods

Script blocks

No script blocks

Property details

List<String> additionalParameters

List of additional parameters to be passed to dx.

String javaMaxHeapSize

Specifies the -Xmx value when calling dx. Example value is "2048m".

boolean jumboMode

Enable jumbo mode in dx (--force-jumbo).

boolean keepRuntimeAnnotatedClasses

Keep all classes with runtime annotations in the main dex in legacy multidex.

This is enabled by default and works around an issue that will cause the app to crash when using java.lang.reflect.Field.getDeclaredAnnotations on older android versions.

This can be disabled for for apps that do not use reflection and need more space in their main dex.

See http://b.android.com/78144.

Integer maxProcessCount

The maximum number of concurrent processes that can be used to dex. Defaults to 4.

Be aware that the number of concurrent process times the memory requirement represent the minimum amount of memory that will be used by the dx processes:

Total Memory = maxProcessCount * javaMaxHeapSize

To avoid trashing, keep these two settings appropriate for your configuration.

Boolean optimize

Whether to run the dx compiler with the --no-optimize flag.

If not specified, debuggable builds will be compiled with optimizations turned off and release builds with optimizations turned on.

boolean preDexLibraries

Whether to pre-dex libraries. This can improve incremental builds, but clean builds may be slower.

Integer threadCount

Number of threads to use when running dx. Defaults to 4.