IntelliJ IDEA 2016.1 Help

Creating an Android Run/Debug Configuration

For general information about run/debug configurations, see Creating and Editing Run/Debug Configurations.

To create an Android run/debug configuration

  1. To start creating an Android run configuration, select Run | Edit Configuration from the main menu. Alternatively, click Shift+Alt+F10 and select Edit Configuration from the pop-up menu.
  2. Click the Add New Configuration button add.png on the toolbar and select Android Application from the pop-up list.
  3. 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.
  4. Specify the .apk file 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 .apk built from the module specified in the Module drop-down list above. The .apk is built automatically, no preliminary artifact configuration is required from your side.
    • To run or debug a custom .apk that will be later embedded in an application, choose the Deploy custom artifact option in the Package area and select the artifact to build the .apk from. 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 browseButton.png 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 addAndroidDebuggerToProcess.png on the toolbar (see Debugging a Running Application).
  5. 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 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.

See Also

Last modified: 13 July 2016