24

What are the meaning of the dexOptions.incremental, etc. Any body can explain them to me.

dex options

android {
    dexOptions {
        incremental false
        preDexLibraries = false
        jumboMode = false
        javaMaxHeapSize "2048M"
    }
}
This affects all tasks using dex.
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
snowdream
  • 933
  • 2
  • 13
  • 27

3 Answers3

31

boolean incremental

Whether to enable the incremental mode for dx. This has many limitations and may not work. Use carefully.

String javaMaxHeapSize

Sets the -JXmx* value when calling dx. Format should follow the 1024M pattern.

boolean jumboMode

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

boolean preDexLibraries

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

These can be found here:
http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html

Community
  • 1
  • 1
wyverny
  • 472
  • 5
  • 9
  • Check https://developer.android.com/studio/build/optimize-your-build.html#dex_options for latest info, for example, using `javaMaxHeapSize` is not recommended. – Juuso Ohtonen Aug 14 '17 at 03:26
1

set incremental to true.

This is experimental feature that is disabled by default. However you can enable it. I personally didn't noticed any changes in term of speed (if it affect the speed).

More explanation can be found there https://stackoverflow.com/a/24224385/513413.

Community
  • 1
  • 1
Hesam
  • 52,260
  • 74
  • 224
  • 365
0

Example:

dexOptions {
    preDexLibraries = false
    incremental true
    javaMaxHeapSize "12g"
}

afterEvaluate {
    tasks.matching {
      it.name.startsWith('dex')
    }.each { dx ->
      if (dx.additionalParameters == null) {
          dx.additionalParameters = ['--multi-dex']
      } else {
          dx.additionalParameters += '--multi-dex'
      }
    }
}
S.Spieker
  • 7,005
  • 8
  • 44
  • 50
Parth Patel
  • 118
  • 1
  • 1
  • 10