IntelliJ IDEA 2021.1 Help

Android compilers

File | Settings | Build, Execution, Deployment | Compiler | Android Compilers for Windows and Linux
IntelliJ IDEA | Preferences | Build, Execution, Deployment | Compiler | Android Compilers for macOS
The Settings icon Ctrl+Alt+S

Use this page to configure the behavior of the Android dx tool and the ProGuard tool. This tool converts compiled class files to executable .dex files in the Dalvik format for further execution in the Android environment.

On this page:

DEX

In this area, configure the behaviour of the Android dx tool that converts the class files to Dalvik byte code.

ItemDescription
Maximum heap sizeUse this spin box to control the size of the heap available to the process that launches the compiler. If you are compiling a particularly large or complex project, you may get out-of-memory errors and be required to increase the amount of memory allocated to the compiler.
Additional VM optionsIn this text box, specify the string to be passed to the Dalvik Virtual Machine for launching the Android application. If necessary, click Icons general expand component and type the desired string in the Android DX Compiler VM Options dialog.

When specifying JVM options, follow these rules:

  • Use spaces to separate individual options, for example, -client -ea -Xmx1024m.

  • If an option includes spaces, enclose the spaces or the argument that contains spaces in double quotes, for example, some" "arg or "some arg".

  • If an option includes double quotes (as part of the argument), escape the double quotes using backslashes, for example, -Dmy.prop=\"quoted_value\".

  • You can pass environment variable values to custom Java properties. For example, if you define a variable MY_ENV_VAR, you can pass it to the foo property as follows:

    -Dfoo=${MY_ENV_VAR}

Optimize
  • Select this checkbox to have the .dex file converted into a .odex file (optimized). The optimized .odex version of a .dex file is stored outside the application package .apk. During the booting of the Android operating system, .odexa files make the basis for building a cache for the Dalvik virtual machine. As a result, the operating system in advance knows what applications will be loaded.

  • When this checkbox is cleared, the generated .dex file is not optimized.

    By default, the checkbox is selected.

Force jumbo modeSelect this checkbox to increase the default number of strings allowed in .dex files. By default, the checkbox is cleared.
Add "--core-library" flagSelect this checkbox to enable containing classes from certain packages as input files. The packages are as follows: java, javax.accessibility, javax.crypto, javax.imageio, javax.management, javax.naming, javax.net, javax.print, javax.rmi, javax.security, javax.sound, javax.sql, javax.swing, javax.transaction, javax.xml.

ProGuard

In this area, configure the behaviour of the ProGuard tool.

ItemDescription
VM optionsIn this text box, specify the additional options for running the ProGuard tool. For example, to increase the default ProGuard heap size, type -Xmx<required maximum heap size>.
Last modified: 23 April 2021