- 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.
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.
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.
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.
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 .
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.
- 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:
- Unplug the USB cable and plug it back in.
- Restart Android Studio.
If your computer still does not find the device or declares it "unauthorized", follow these steps:
- Disconnect the USB cable.
- On the device, open the Developer options in Settings.
- Tap Revoke USB debugging authorizations.
- Reconnect the device to your computer.
- When prompted, grant authorizations.