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. The default scenario is to import 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 About Projects and About modules).
- Select File | New | Project from Existing Sources from the main menu.
- In the dialog that opens, browse to the project (or a directory containing source files) that you want to import:
- 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. In our case IntelliJ IDEA is aware that this Android project uses the Gradle build system, recognizes the
build.gradlefile and suggests importing from Gradle.
- On the third step, you can modify Gradle settings and click Finish. The newly created IntelliJ IDEA project built from the external Gradle model will open.