IntelliJ IDEA 12.1.0 Web Help

File | Project Structure | Modules - module - Android facet

projectStructure

File | Project Structure | Modules - module - Android facet

projectStructure

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

In this section:

Common Android Facet options

In this area, configure Android platforms to build the application against, choose the platform to use in the current module, and enable or disable sharing the module source code and resources.

ItemDescription
Library moduleSelect this check box to enable using the module as library project so Android application projects can reference its source code and resources.
Reset paths to defaultsClick 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 fileIn this text box, specify the path to the AndroidManifest.xml file. The AndroidManifest.xml file should be located in the module root directory.
Resources directoryIn this text box, type 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, type 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 directoryIn this text box, type the path to the folder where the Android native libraries.. The default location is <module root>/libs.

Compiler tab

In this tab, configure the behaviour of various Android compilation tools.

ItemDescription
R.java and Manifest.java files In this area, appoint the folder to store the R.java file with the IDs of all the resources defined in your project and the AndroidManifest.java file with permissions. Both files will be generated automatically based on the definitions of resources and the AndroidManifest.xml file respectively.

By default, IntelliJ IDEA suggests to store the generated files in the gen folder. To change this setting, type the path to the required folder manually in the Directory for generated files text box or click the Browse button browseButton and select the folder in the dialog box that opens.

AIDL files In this area, appoint the folder to store the .aidl files generated by the AIDL Compiler. Accept the location suggested by IntelliJ IDEA in the Directory for generated files text box, or type the path to another folder manually, or click the Browse button browseButton and select the folder in the dialog box that opens.
Resource Packaging In this area, configure the behaviour of the tool that is responsible for creating an Android Package .apk file and specify the location of components to be included in it.
  • Use resource directory specified in "Structure" section: when this option is selected, the compiler takes the resources at the location specified in the Resources directory text box of the Structure tab.
  • Use custom resource directory: select this option to have the package contain resources from another folder than specified in the Resources directory text box of the Structure tab.

    This option is helpful in Maven projects when you need to package the contents of a combined resources directory that contains merged resources from two mutually dependent modules.

  • Include assets from dependencies into APK: select this check box to have assets from dependencies also involved in packaging.
ProGuard In this area, enable the ProGuard tool to obfuscate the application during packaging.
  • Run ProGuard: select this check box to have IntelliJ IDEA obfuscate the debug APK through integration with the ProGuard built-in tool. After you have selected this check box, the Config file text box becomes available.

    Note that for the release APK there is a dedicated check box in the Export signed application package wizard and the Android tab on the Artifact page of the Structure dialog box.

  • Config file: in this text box, specify the location of the configuration file for ProGuard.

    IntelliJ IDEA fills in the field with the path to the default configuration file proguard-project.txt that is created together with the Android module. To change this settings, type the fully-qualified path to the desired file manually or click the Browse button browseButton.png and choose the file in the Select Path dialog box that opens.

APK Path In this drop-down list, specify the target directory for the .apk file, which is obtained as a result of Android module compilation. Choose the APK path from the list or click the Browse button browseButton.png and choose the desired folder in the Select Path dialog box that opens.
Custom debug keystore In this text box, specify the location of the keystore to use the debug key from. Type path manually or click the Browse button browseButton.png and appoint the location in the dialog that opens.

By default, debug keys are stored in <user home>/.android/debug.keystore>. When using builds created on different machines, they all have different signing, so you have to uninstall the existing application before installing the application from another machine. To solve this problem, keystore files are often stored in a version control system alongside the source code. To have IntelliJ IDEA use the repository keystore instead of the default one, specify the relevant location in the Custom debug keystore field.

Include test code and resources into APKSelect this check box to include the sources and resources, located under the test roots, into the debug APK, which is created in course of project build.
(Test data is never included in the release APK, which is created via the Export signed application package wizard.

Note that check box is cleared by default this for the regular Android modules; for the test modules this check box is selected by default.

See Also

Procedures:

Reference:

External Links:

Web Resources: