In this post, we will learn on how to run or debug android app using real android device. We will see how to use USB to connect device with laptop and run android app(in Android Studio IDE) in phone.
Getting Started
As a developer, if you are developing an android app for a phone, you should test it on real device. Of course, you can use emulator. But, that does not provide 100% correct experience.
So, we need to learn how use real android device with android studio IDE to run any android application.
Enabling Developer Options in Phone
To be able to run android app from android studio IDE, we need to enable developer option in phone.
Allowing Developer options enable developer to use phone for development purposes.
So, we will enable it now.
Enabling Developer Options in real device may differ based on different mobile. But, most of the steps will be similar. Here, we are using MI 10i phone. So, steps given below will be accordingly.
Follow steps below to do enable Developer Options in device –
- Go to Settings. Below screen will be shown
-
Now, Click on About Phone. It will navigate to below screen.
-
Now, click on MIUI Version 7 times quickly to enable Developer Options.
-
Now, go to Settings => Additional Settings. We can see a Developer Options there.
-
Inside Developer Options, we see ui like below –
Enabling Developer Options is not enough. We need to enable USB Debugging options to be able to connect device with laptop.
Enable USB Debugging
We have successfully enabled Developer Options. Now, we need to enable USB debugging so that device can be attached with android studio IDE.
Follow steps below to do it –
- Go to Settings =>Additional Settings => Developer Options
- Find USB Debugging option. Currently, it’s disabled. Click on it.
-
Clicking on USB Debugging opens popup to ask for confirmation message. Click OK if it’s ok for you.
-
Finally, we will see USB Debugging option enabled as shown below –
Enable Developer option and USB Debugging (Video Sample)
If there is any issue while going through process, you can see sample video here –
Connect Device to Computer
Till now, we have enabled Developer Options and USB Debugging. Now, we need to connect phone again using USB cable. It should be detected in Android Studio now.
Run Android App using Real Device
We have already created a HelloWorld App in Android Studio. Now, we will run that application using provided run icon. Click on it. Finally, HelloWorld App should look like below –
Debug Android App using Real Device
Now, we can add a break point where-ever we want to debug. Then, start debugging app.
Thus, have seen how to run or debug android app in real device.
You must be logged in to post a comment.