This tutorial explains how to connect your Android device to Android Studio with step by step instructions.
Explanation
Creating apps in Android Studio is very easy. What about running and testing? Android Studio provides us a way we can run over apps on our handset Android devices very easily and quickly. If you don’t have an Android device, don’t worry, Android Studio has an emulator for you, it creates virtual Android device, so you can run and text your apps without actually having an Android smartphone. This time I will show you how to connect Android device to Android Studio. As there is no substitute for running your apps on hardware devices.
Pre requisite
Following are some pre requisite for this:
- Android Studio (if you don’t have it, see the previous tutorial for installation of Android Studio).
- USB cable
- Android device
Step 1) Enable USB debugging
The very first step is to enable USB debugging on your Android device. To do this follow these steps
- On your phone (or tablet) go to Settings=> About Phone
- Tap Build Number 7 times, after 7th time it will say You are now a developer.
- You will notice Developer’s Options are now available.
- Go to the Developer option and enable USB debugging
Click OK.
Step 2: Install USB driver
Next step is to install USB driver for your Android device. For this follow instructions from your device manufacturer. For example, I am using Android smartphone of Huawei, so I just downloaded Huawei USB driver from their official website. If your device uses Google USB driver you can download from this link http://developer.android.com/sdk/win-usb.html. After installation you need to update it. Make sure your device is connected through a USB cable. Go to the Control Panel => Device Manager then locate and right click your Android device and click Update driver software.
Note: Make sure your Android device is not sleeping while connected through USB cable.
Step 3: Run your app
No you can run your Android app. Right click on the app and click Run. Or simply select run option from the tool bar menu shown below.
A window Select Deployment Target will appear, and a list of available devices will appear. Choose your device and click OK. Android Studio will run your application in your Android device.
Click on Use same selection for future launches if you want to save this setting for later apps.
References
Official Android OEM driver installation guidelines
Samsung Android USB driver for Windows
View Comments (3)
Very useful, thank you so much. :)
tks
When trying to run on android I'm running into a numberformatexception with the value "google_app_id". Anyone know what needs to be set?