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).

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.gradle file 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.