In the Previous Article We have Discussed about How To Install Android Studio and Running your First Basic App. We now Discuss in detail about How to Test or Run the android App on real devices like Android Mobile, Android Tablet.
There are Two Ways To Test an Android App:
1. Using a Real Device,
2. Using an Emulator
How to Test Android App on Real Device:
To test Android App using Real Device such as Android Mobile or Tablet, firstly you need to Enable USB debugging. This USB Debugging option is available inside Developer options which may not be directly available to android users. These Developer options can be accessed in Two ways depending Upon the version your Android Device is Running:[widget id=”text-3″]
a. For Devices Running with Android V3.2 or Older:
For these Devices you can access the Developer options by going to Settings –> Applications –> Development. There you should enable USB Debugging.
b. For Devices Running with newer Versions From Android V4.0:
For these Devices, The Developer options are not visible by default. You can access the Developer options by going to Settings –> About Phone –> Build Number. Now tap the Build Number for 7 Times so you can gain Access to Developer options. Now you can see a Toast Displaying that you are now a developer. Now return back to Settings. There you can now see Developer options above About Tablet. Enter into Developer Options and There you must enable USB Debugging.
Now the Final step is to Install Drivers for your Windows to detect the device. For mac, it is not needed.
Steps for Installing Drivers for Windows:
1. Firstly, go to Android SDK Manager which can be accessed by clicking the SDK Manager icon shown in Image below:
2. Check Mark the Google USB Driver as shown in image below and Hit Install Package .
3. After Installing Google USB Driver, close SDK Manager window, Now Connect your Device through USB cable to your pc.
4. Now click on Windows Explorer and Right Click on My Computer (Windows 7) (or) This PC(Windows 8.1). Now Select Manage.
5. Now Select Device Manager –> Portable Devices –> Your Device Name
6. Right Click on Your Device Name and Select Browse My Computer For Driver Software.
7. Now Point it to C:\Users\YourUserName\AppData\Local\Android\sdk\extras\google\usb_driver. Hit Next and Finish.
Now your PC and Android Studio can recognize your Device if you carefully followed the above steps.
Make Sure that you Checked USB Debugging in Developer Options and Selected OK to allow USB Debugging. You will be asked to Allow USB Debugging for each different Computer you connect your device, showing its RSA fingerprint.
Now You Hit Run Button after selecting Your Project in Project Explorer in Android studio. You will be shown a Window for choosing a Device. If you followed above steps, Your Device will Be shown as Online similar to image shown Below:
Now Hit OK.[widget id=”text-3″]
Your Device will now Run the App! Note that this is One time Configuration. Testing Your app on real device is the Recommended way as it is the faster compared to That of running the app through Emulator. In the Next article we will discuss about Testing the App through Emulator.