Creating a New Android Project
Launch the New Project wizard. If no project is currently opened
in IntelliJ IDEA, click Create New Project on the Welcome screen:
Otherwise, select File | New | Project from the main menu.
On the first page of the wizard, select Android in the left pane and
Application Module in the right pane:
An Application module is a module that is ready for developing a fully functional Android application. IntelliJ IDEA will create an application package and set up the Android-specific module structure. For details on other Android module types, refer to Getting Started with Android Development.
On the second page of the wizard, specify the name of the application that will be implemented in
this module (for example,
HelloDroid). The name of the package where the application classes will be stored is built automatically, but you can edit it if you like. The package name must have the following format: com.xxx.yyy, where xxx usually stands for your company name, and yyy is the application name. Note that you can use any names here, but the suggested pattern significantly reduces the risk of name conflicts with other applications.
On this step, IntelliJ IDEA also offers to create a sample activity named MyActivity. In Android development, an activity is a plain Java class and an essential component of any Android application. Specify the title of the window that will be displayed on the sample application start.
On the third page, if you like, modify the project name (by default, it is the same as the application
name) and the default project location.
Now you need to configure the Java SDK and the Android SDK if you haven't created any Android projects before and specified the paths to the SDKs. Click New. A warning will appear telling you that you need to configure a Java SDK. Click OK and specify the path to the Java SDK you have downloaded in the dialog that opens. Next, specify the path to the Android SDK. Click OK in the dialog that opens showing you the versions of the Java SDK and the Android SDK you have selected:
Next you need to select the target device where the application will be run and debugged. Select one of the following options from the Target device drop-down list:
- Do not create run configuration: select this option if you do not want to set the Run/Debug configuration at this point. You will be prompted to configure it when you first launch a run or a debug session.
- Show device chooser dialog: if this option is selected, the Choose Device Dialog will be displayed each time you start a run or a debug session.
- USB device: if this option is selected, IntelliJ IDEA will automatically detect a plugged-in USB device upon the application start.
- Emulator: if this option is selected, the preferred Android Virtual Device will be launched when you start a run or a debug session. If you have no Android Virtual devices configured, the Create Android Virtual Device dialog will be displayed.
Optionally, click the arrow next to More Settings and modify the default location of the
.imlmodule file and the content root of the module.
Finally, you can select project format (file-based or directory-based).
Click Finish to complete the wizard. Your Android project will be created with the predefined project structure: