Google is committed to advancing racial equity for Black communities. See how.

[OPTIONAL] Run your app on a mobile device

Prerequisites

  • Basic understanding of how to use Android Studio.
  • Ability to open and adjust settings on your Android device.

What you'll learn

  • How to enable your Android device to run apps from Android Studio.
  • How to connect and run an app in Android Studio on a physical Android device.

What you need

  • Android Studio downloaded and installed on your computer.
  • An app project set up in Android Studio.
  • An Android device, such as a phone or tablet.
  • A USB cable to connect your Android device to your computer via their USB ports.

To let Android Studio communicate with your Android device, you must enable USB debugging in the Developer options settings of the device.

On Android 4.2 (Jellybean) and higher, the Developer options settings are hidden by default. To show developer options and enable USB debugging:

  1. On your Android device, open Settings, and search for About phone.
  2. Tap on About phone, and then tap Build number seven times. Enter your device password or pin, if prompted.
  3. Return to Settings, and tap System.

Developer options should now appear in the list. You may need to open the Advanced options to find it.

  1. Tap Developer options, and then turn on USB debugging.

If you've installed Android Studio on a Windows-based computer, you must install a USB device driver before you can run your app on a physical device.

  1. In Android Studio, click Tools > SDK Manager.

The Settings for New Projects window displays.

  1. Click the SDK Tools tab.
  2. Select Google USB Driver and click OK.

When done, the driver files are downloaded into the android_sdk\extras\google\usb_driver\ directory. You should now be able to connect and run your app from Android Studio.

Now you can connect your device and run the app from Android Studio.

  1. Connect the Android device to your development machine with a USB cable. A dialog should appear on the device, asking to allow USB debugging.

  2. Select the Always allow option to remember this computer. Tap OK.
  3. On your computer, in the Android Studio toolbar, click the Run button Android Studio Run icon.

The Select Deployment Target dialog opens with the list of available emulators and connected devices. You should see your physical device along with any emulators.

  1. Select your device, and click OK.

Android Studio installs the app on your device and runs it.

If Android Studio does not recognize your device, try the following:

  1. Unplug the USB cable and plug it back in.
  2. Restart Android Studio.

If your computer still does not find the device or declares it "unauthorized", follow these steps:

  1. Disconnect the USB cable.
  2. On the device, open the Developer options in Settings.
  3. Tap Revoke USB debugging authorizations.
  4. Reconnect the device to your computer.
  5. When prompted, grant authorizations.