1. Before you begin
- 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.
2. Turn on USB debugging
To let Android Studio communicate with your Android device, you must enable USB debugging in the Developer options settings of the device.
To show developer options and enable USB debugging:
- On your Android device, open Settings, and search for About phone.
- Tap on About phone, and then tap Build number seven times. Enter your device password or pin, if prompted.
- 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.
- Tap Developer options, and then turn on USB debugging.
3. Install the Google USB Driver (Windows only)
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.
- In Android Studio, click Tools > SDK Manager.
The Settings for New Projects window displays.
- Click the SDK Tools tab.
- 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.
4. Run your app on the Android device (all operating systems)
Now you can connect your device and run the app from Android Studio.
- Connect the Android device to your development machine with a USB cable. A dialog should appear on the device, asking to allow USB debugging.
- Select the Always allow option to remember this computer. Tap OK.
- In Android Studio on your computer, make sure your device is selected in the dropdown. Click .
- Select your device and then click OK.
Android Studio installs the app on your device and runs it.
- If your computer runs Linux or Windows, and you can't run your app on a physical Android device, see Run apps on a hardware device for additional steps.
- If your computer runs Windows and the emulator installation doesn't work, see Install OEM USB Drivers for the appropriate USB driver for your device.
- If Android Studio doesn't recognize your device, unplug the USB cable and plug it back in. Restart Android Studio.
- If your computer still doesn't find the device or declares it unauthorized, disconnect the USB cable. Then on the device, tap Settings > Developer options > Revoke USB debugging authorizations. Reconnect the device to your computer. When prompted, grant authorizations.
You learned how to run an app in Android Studio on your physical Android device!