Skip to content

Most visited

Recently visited

navigation

Run Your App

This lesson teaches you to

  1. Run on a real device
  2. Run on an emulator

In the previous lesson, you created an Android project that displays "Hello World." You can now run the app on a real device or an emulator.

Run on a real device

Set up your device as follows:

  1. Connect your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document.
  2. Enable USB debugging on your device by going to Settings > Developer options.

    Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.

Run the app from Android Studio as follows:

  1. In Android Studio, click the app module in the Project window and then select Run > Run (or click Run in the toolbar).
  2. In the Select Deployment Target window, select your device, and click OK.

Android Studio installs the app on your connected device and starts it.

That's "hello world" running on your device! To start developing, continue to the next lesson.

Run on an emulator

Before you run your app on an emulator, you need to create an Android Virtual Device (AVD) definition. An AVD definition specifies the characteristics of an Android phone, tablet, Android Wear, or Android TV device that you want to simulate in the Android Emulator.

Create an AVD Definition as follows:

  1. Launch the Android Virtual Device Manager by selecting Tools > Android > AVD Manager, or by clicking the AVD Manager icon in the toolbar.
  2. In the Your Virtual Devices screen, click Create Virtual Device.
  3. In the Select Hardware screen, select a phone device, such as Pixel, and then click Next.
  4. In the System Image screen, click Download for one of the recommended system images. Agree to the terms to complete the download.
  5. After the download is complete, select the system image from the list and click Next.
  6. On the next screen, leave all the configuration settings as they are and click Finish.
  7. Back in the Your Virtual Devices screen, select the device you just created and click Launch this AVD in the emulator .

While the emulator starts up, close the Android Virtual Device Manager window and return to your project so you can run the app:

  1. Once the emulator is booted up, click the app module in the Project window and then select Run > Run (or click Run in the toolbar).
  2. In the Select Deployment Target window, select the emulator and click OK.

Android Studio installs the app on the emulator and starts it.

That's "hello world" running on the emulator! To start developing, continue to the next lesson.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.