IntelliJ IDEA 2022.2 Help

Android facet page

Use this page to configure the settings of an Android facet attached to a specific module.

Common Android facet options

In this area, configure the facet general settings.

Item

Description

Library module

Select this checkbox to turn this module into a library module, so that other Android application projects can reference its source code and resources.

Update "project.properties" file automatically

Select this option if you want the project.properties file to be updated automatically when one of the following options is enabled or disabled:

  • Library module

  • Enable manifest merging

Reset paths to defaults

Click this button to return to the default Android facet settings.

Structure tab

In this tab, specify the location of the key application components in the module tree structure. Based on these settings, IntelliJ IDEA supports code completion, resolves references, and provides other types of coding assistance.

Item

Description

Manifest file

In this field, specify the path to the AndroidManifest.xml file. This file contains the information that is required to run the application. It must be located in the module root directory.

Resources directory

In this field, specify the path to the folder where the application resources are stored. Resources located in this directory are assigned IDs and can be referenced through the R.java file or from XML resource definition files. The default location is <module root>/res.

Assets directory

In this field, specify the path to the folder where the application assets are stored. Files located in this directory are not assigned IDs and cannot be referenced through the R.java file or from XML resource definition files. You can access this directory like a normal file system and read data from these files using the AssetManager. The default location is <module root>/assets.

Native libs directory

In this field, specify the path to the folder where the Android native libraries are stored. The default location is <module root>/libs.

Generated Sources tab

In this tab, specify the location of the application source files.

Item

Description

Generate sources automatically

Select this option if you want the R.java, AndroidManifest.java and .aidl files to be generated automatically based on the definitions of resources and the AndroidManifest.xml file.

R.java and Manifest.java files

In this area, specify the target folder for the R.java file that contains IDs of all resources defined in your project, and the AndroidManifest.java file that contains permissions.

To change the default location, type the path manually or click Browse the Browse button and select the target folder in the dialog that opens.

AIDL files

In this area, specify the target folder for the .aidl files generated by the AIDL Compiler.

To change the default location, type the path manually or click Browse the Browse button and select the target folder in the dialog that opens.

Packaging tab

In this tab, configure the behavior of the Android Asset Packaging Tool (aapt) that is responsible for creating an .apk file.

Item

Description

Use resource directory specified at "Structure" section

Select this option if you want the compiler to use the resources from the location specified in the Resources directory field in the Structure tab.

Use custom resource directory

Select this option if you want the package to contain resources from a location different from the one specified in the Resources directory field in the Structure tab.

Type the path manually or click Browse the Browse button and select the target folder in the dialog that opens.

Include assets from dependencies into APK

Select this option if you want to include assets from dependencies into the application package.

Rename manifest package

Select this option if you want the application ID to be changed on build time, and specify the new name.

This option is only available for Application modules.

Enable manifest merging

Select this option if you want to automatically merge manifest files of library modules with the manifest file of the application that contains this library module.

This option is only available for Application modules.

Additional command line parameters

In this field, type the additional parameters to be passed to the Android Asset Packaging Tool(aapt). If the set of additional parameters does not fit into the field, click App general expand component and specify the parameters in the dialog that opens.

For example, if you want to include resources of a certain type in an uncompressed format, type -0 <file extension for this type of resources>.

APK path

Specify the target directory for the .apk file that will be generated as a result of Android module compilation.

Select a folder from the list, or click Browse the Browse button and specify the path in the dialog that opens.

Custom debug keystore

In this field, specify the location of the keystore where the debug key you want to use is located.

Type the path manually or click Browse the Browse button and select a folder in the dialog that opens.

Include test code and resources into APK

Select this option to include sources and resources located under the test roots into the debug APK created on build time. Test data is never included in the release APK that is generated via the Generate Signed APK wizard.

Pre-dex external jars and Android library dependencies

During the application packaging, the class files of a library module are converted into .dex files. This operation is referred to as dexing. Finally, the .dex files output from the library module is included in the final application .apk (learn more about the building procedure from Building and Running).

As a rule, the contents of a library module remain unchanged. In this case you can have them dexed only once, whereupon the output .dex files are included in the .apk. This approach is referred to as pre-dexing.

By default, IntelliJ IDEA pre-dexes library mode dependencies as well as external jars that have not been updated since the previous build. You can change these settings so that all class files are always dexed.

When this option is selected, .dex files output from class files of library modules or external .jars are pre-dexed. That means they are not dexed anew if the corresponding class files have not been updated since the previous build. If this checkbox is cleared, all class files are dexed on each build.

This option is unavailable for Library modules.

ProGuard tab

In this tab, enable the ProGuard tool used to obfuscate the application during packaging.

Item

Description

Proguard logs directory

This field shows the default location of the ProGuard logs.

To modify the location, click Browse the Browse button and select a folder in the dialog that opens.

Run ProGuard when building debug APK

Select this option if you want IntelliJ IDEA to obfuscate the debug APK through integration with the built-in ProGuard tool.

Note that for release application packages, there is a dedicated checkbox in the Generate Signed APK wizard and in Project Structure | Artifacts | Android tab.

Config file paths

This field shows the default location of the proguard-project.txt configuration file that is created automatically together with an Android module.

To modify the location, click Browse the Browse button and select a folder in the dialog that opens.

Multi-dex tab

In this tab you can configure the multi-dex support.

Item

Description

Enable multi-dex support

Select this checkbox to enable Android multi-dex feature.

Main dex list

Specify the main dex list.

Minimal main dex

Select this checkbox for minimal main dex. This option lets you put only classes that are selected by main dex list into the main dex.

Last modified: 29 November 2022