Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I use Android dexOptions?

Tags:

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. 
like image 446
snowdream Avatar asked Mar 08 '15 13:03

snowdream


People also ask

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)

What is Javamaxheapsize Android?

its the maximum Ram that gradle can use while creating the build(apk file).

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.


2 Answers

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

like image 76
wyverny Avatar answered Nov 04 '22 10:11

wyverny


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.

like image 23
Hesam Avatar answered Nov 04 '22 09:11

Hesam