IntelliJ IDEA 2016.1 Help

Importing an Existing Android Project

With IntelliJ IDEA you can not only create an Android project from scratch, but also import an existing project developed using other tools. One of the most common scenarios is importing an existing Android-Gradle project. However, you can also import a Maven, Eclipse or Flash Builder project, or even build a new project from a bunch of source files.

As a rule, when you import a project, your source files remain in their original location - IntelliJ IDEA simply creates a superstructure that allows treating your sources, libraries and other assets as an IntelliJ IDEA project. IntelliJ IDEA automatically generates the .idea directory that contains a set of configuration files (.xml), and a project file (.iml) for each of the project modules (for more details, see Project and Module).

  1. Select File | New | Project from Existing Sources from the main menu.
  2. In the dialog that opens, browse to the project (or a directory containing source files) that you want to import:
  3. On the second step, select whether you want to build a project from scratch using the files under the specified directory, or whether you want IntelliJ IDEA to build a project according to the selected model and proceed in a more automated way.

    Select the Create project from existing sources option.

  4. On the third step, you can modify the name of the new project that will be created from existing source files. IntelliJ IDEA also displays the directory where the source files are located and where the new project will be created:
  5. On the fourth step, you are asked which folders you want to add to the project roots. Since in our scenario there is no known model to process, IntelliJ IDEA tries to match whatever is available in the source directory you have specified and what a regular Android project requires. Accept the default selections:
  6. On the fifth step, confirm the import of any libraries found in the source project:
  7. On the sixth step, review the suggested module structure. You can rename modules, exclude particular modules from the project, split or merge modules:
  8. On the seventh step, you need to specify the Java SDK and the Android SDK that will be used for your project. Since we already defined these SDKs in IntelliJ IDEA when we created a new Android project, they should appear in the left pane. If you have not configured the SDKs before, click the Add button add_icon and select the SDK type. Then, in the dialog that opens, select the path to the desired SDK. For instructions and download links, refer to Prerequisites for Android Development.
  9. On the eighth step, IntelliJ IDEA locates the files that are indicators of certain frameworks and technologies inside your project. In the case with Android projects, such indicators are AndroidManifest.xml files that must be present in every Android application root directory and that contain the information required to run the application. Leave the default selections so that IntelliJ IDEA creates an Android facet for each of the project modules.
  10. Click Finish to complete the wizard. The newly created IntelliJ IDEA project built from existing sources will open:

See Also

Last modified: 13 July 2016