For general information about run/debug configurations, see Creating and Editing Run/Debug Configurations.
- To start creating an Android run configuration, select from the main menu. Alternatively, click Shift+Alt+F10 and select Edit Configuration from the pop-up menu.
- Click the Add New Configuration button
on the toolbar
and select Android Application from the pop-up list.
- On the Run/Debug Configuration: Android Application page that opens, specify the configuration name and select the module to which this configuration will be applied.
-
Specify the
.apkfile that will be deployed on the target device and appoint the activity that will be launched on the application start.-
To run or debug the entire application,
choose the Deploy default APK option in the Package area
and Launch default Activity in the Activity area.
IntelliJ IDEA will upload the
.apkbuilt from the module specified in the Module drop-down list above. The.apkis built automatically, no preliminary artifact configuration is required from your side. -
To run or debug a custom
.apkthat will be later embedded in an application, choose the Deploy custom artifact option in the Package area and select the artifact to build the.apkfrom. In this case, you have to define the artifact manually before creating a run/debug configuration (see Generating a Signed Release APK Through an Artifact and Configuring Artifacts for details). Then select the Launch option in the Activity area and specify the start-up activity from the chosen artifact (.apk). Type the activity name manually or click the Browse button
and select it in the Select Activity Class dialog box that opens.
The list of available activities is determined by the choice of the module.
-
If you are going to start a debugging session for an already running application, select Do not deploy anything in the Packages area
to suppress uploading data to the device, and then select Do not launch activity in the Activity area.
Executing a run configuration with these settings is the same as clicking the Attach debugger to Android process button
on the toolbar (see Debugging a Running Application).
-
To run or debug the entire application,
choose the Deploy default APK option in the Package area
and Launch default Activity in the Activity area.
IntelliJ IDEA will upload the
-
In the Target Device area, specify the device where the application will be launched.
-
To specify a virtual device, select the Emulator option and choose a virtual device from the
Prefer Android Virtual Device drop-down list.
If no virtual devices are available, click the Browse button
to
start the Android Virtual Device (AVD) Manager and configure a new emulator (for details, refer to Managing Virtual Devices).
- If you want to select a target device manually select the Show chooser dialog option. Each time you start a run/debug session and apply this configuration, IntelliJ IDEA will display the Choose Device dialog.
- To have IntelliJ IDEA detect a plugged-in USB device upon the application start, select the USB device option.
Selecting the Show chooser dialog or USB device option may be helpful if you are going to run the application on a physical device which will be plugged-in later and, therefore, the set of available devices cannot be foreseen.
-
To specify a virtual device, select the Emulator option and choose a virtual device from the
Prefer Android Virtual Device drop-down list.