Creating an Android Run/Debug Configuration
- 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.
.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 Default APK from the Deploy drop-down list in the Installation Options area
and Default Activity from the Launch drop-down list in the Launch Options 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 Custom Artifact option from the Deploy drop-down list in the Installation Options 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 Working with Artifacts for details). Then select the Specified Activity option from the Launch drop-down list in the Launch Options 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 Default APK from the Deploy drop-down list in the Installation Options area and Default Activity from the Launch drop-down list in the Launch Options area. IntelliJ IDEA will upload the
In the Deployment Target Options 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 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.