IntelliJ IDEA 2016.3 Help

Getting Started with Android Development

In this topic:

Before you start

Choosing the module type you need

IntelliJ IDEA lets you choose Application modules (form factors) when you create your project, add different Android modules to an existing project, or add Android facets to your modules.

Creating an Android project

  1. In the menu, choose File | New | Project to open the New Project Wizard. In the left-hand pane select Android .
  2. In the right-hand pane configure your new project and click Next.
  3. On the next page of the wizard, select the application module type and its minimum SDK. Click Next.
  4. On the next page of the wizard, select the Android activity and click Next.
  5. On the next page of the wizard, specify the Activity settings and click Finish.

Adding an Android module to a project

  1. Choose File | New | Module from the main menu or New | Module from the context menu of the Project tool window.

    The New Module wizard opens.

  2. In the left-hand pane, select Android. In the right-hand pane, select a module you want to add and click Next.
  3. On the next page of the wizard, specify the application or library name, module name, package name and a minimum SDK that is required for this type of application. Click Next.
  4. On the next page of the wizard, select an activity for your module and click Next.
  5. On the next page of the wizard, specify the settings to customize the selected activity and click Finish.

Attaching an Android facet to an existing Java module

You need to perform this procedure if you want to attach an Android facet to an existing Java module. Android modules have this facet applied by default.

  1. Open the Project Structure dialog box.
  2. Under Project Settings, select Modules.
  3. Select the module you want to add an Android facet to, click /help/img/idea/2016.3/new.png, and choose Android.
  4. On the Facet 'Android' page that opens, specify the location of the key application components in the Structure tab: the AndroidManifest.xml file, the application resources, the application assets, and the Android native libraries..

    If necessary, you can edit the default paths. To return to the default Android facet settings, click Reset paths to defaults.

  5. To make the module source code and resources available from other projects, select the Library module check box on top of this page.

Configuring the code style of Android-specific XML definition files

Android development involves working with dedicated XML files, such as layout and resource definition files, manifest files, etc. You can have IntelliJ IDEA apply the standard XML code style to such files, or configure custom code style settings for them.

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for OS X. Expand the Editor node, and then click XML under Code Style.
  2. On the Code Style:XML page that opens, switch to the Android tab.
  3. Do one of the following:
    • To define a custom code style for Android-specific XML files, select the Use custom formatting settings for Android XML files check box and configure the settings to be applied to various types of Android XML files using the controls of the tab as described in Code Style:XML - Android.
    • To have IntelliJ IDEA format Android-specific XML files according to the standard XML code style settings defined in the other tabs of the page, clear the Use custom formatting settings for Android XML files check box.

See Also

Last modified: 21 March 2017