IntelliJ IDEA 2016.2 Help

Android Facet Page

File | Project Structure | Modules | <module> | Android
File | Project Structure | Facets | Android (<module>)


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

In this section:

Common Android facet options

In this area, configure the facet general settings.

ItemDescription
Library module Select this check box 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.

ItemDescription
Manifest file In this text box, 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 text box, 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 text box, 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 text box, 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.

ItemDescription
Generate sources automatically Select this option if you want the R.java, AndroidManifest.jave 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.jave file that contains permissions.

To change the default location, type the path manually or click the Browse button browseButton 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 the Browse button browseButton 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.

ItemDescription
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 the Browse button browseButton 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 (for more information, see Renaming an Application Package).

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 (for more information, see Sharing Android Source Code and Resources Using Library Projects).

This option is only available for Application modules.

Additional command line parameters In this text box, 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 text box, click shift-enter-button 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 drop-down list, or click the Browse button browseButton and specify the path in the dialog that opens.

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

Type the path manually or click the Browse button browseButton 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 check box 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.

ItemDescription
Proguard logs directory This text box shows the default location of the ProGuard logs.

To modify the location, click the Browse button browseButton 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 check box in the Generate Signed APK wizard and in Project Structure | Artifacts | Android tab.

Config file paths This text box 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 the Browse button browseButton and select a folder in the dialog that opens.

Multi-dex tab

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

ItemDescription
Enable multi-dex supportSelect this check box to enable Android multi-dex feature.
Main dex listSpecify the main dex list.
Minimal main dexSelect this check box for minimal main dex. This option lets you put only classes that are selected by main dex list into the main dex.

See Also

Last modified: 23 November 2016