Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the meaing of: incremental, preDexLibraries, jumboMode, inside dexOptions?

inside build.gradle we can add that params

android {     dexOptions {         incremental          preDexLibraries         jumboMode          javaMaxHeapSize     } } 

but documentation is too low

http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html#com.android.build.gradle.internal.dsl.DexOptions

boolean incremental

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

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.

1) which limitations are in incremental?

2) what is jumbo mode?

3) what is pre-dex libraries?

like image 913
Xan Avatar asked Oct 01 '15 15:10

Xan


People also ask

What is preDexLibraries?

preDexLibraries (the answer of your third Q): it builds dex file out of libraries so it can be used in incremental builds (not building dex files every time for libraries). so using this item when clean build makes everything a little slower.

What is Dexoptions?

So dexoptions is a gradle object where some options to configure this java-code-to-android-bytecode transformation are defined. The options configured via this object are : targetAPILevel. force-jumbo mode (when enabled it allows a larger number of strings in the dex files)


1 Answers

first of all lets see whats dex file. in pure java when you compile the java code,it will be compiled into a .class file while in android your java code will be compiled into .dex file. (both are bytecodes but different)

incremental: it means Gradle will use previous dex file and appends the new changes to them (not building them again every time).

the answer of your first Q: e.g. one of the limitation were you couldnt use it along with multidex* (though this limitation was solved - for sdk versions 21+ incremental builds are possible for multidex apks by rebuilding only the affected dex files)

-note: you dont need to worry about this limitations anymore because incremental option is true by default since Gradle version 2.1.0

multidex: this option means compiling java code into multiple dex file you dont need this unless your code methods outnumbers the max limitation on a single dex file (64k methods)

jumboMode (the answer of your second Q): there is also a limitation for strings count in the dex file enabling this option will extend the strings count in dex file (this option is true since Gradle 2.1.0 so you dont have to worry about it either)

preDexLibraries (the answer of your third Q): it builds dex file out of libraries so it can be used in incremental builds (not building dex files every time for libraries). so using this item when clean build makes everything a little slower.

like image 97
Amir Ziarati Avatar answered Sep 23 '22 22:09

Amir Ziarati