To test or run an android app on real device such as mobile or phone is faster than AVD. We have a different approaches available to run an android app on real device, those are
If we enable USB Debugging and connect the device to system, automatically our device will be shown online in android emulator device list to run our app on real device.
Instead of enabling USB Debugging, we can directly Build APK for our app in android studio and by installing that APK on our mobile / phone, we can run and test our app.
Now we will see step by step process to enable USB Debugging on Device and Building an APK for an App using android studio to run and test the app on real device with examples.
Now open the Settings section in the device which you want to run the android app like as shown below.
In case Developer options not enabled in your phone, search for “About Phone or About Device” option and Click on it like as shown below.
After that search for the Build number option and tap on it for 7 times to enable Developer options like as shown below.
Now go back and click on Developer options to enable USB Debugging option like as shown below.
Once you enable USB Debugging option, it will show the notification message like as shown below and click OK to enable USB Debugging.
Now connect your device to the system via data cable and select allow USB Debugging option. After that select Run App option in android studio to run your app from emulator like as shown below.
In case your device connected to the system and if it in online, that will be shown in emulator window to run the app in real device like as shown below.
This is how we can enable USB debugging on real device to test or run android application based on our requirements.
In case if you are not interested to do USB debugging, then we can build an app APK using android studio and install it on real device to test or run our application functionality.
Open your app in android studio, Go to Build option in menu bar and select Build APK option like as shown below.
After click on Build APK option, our android studio will generate an APK for our application and it will show the APK generated path like as shown below.
Now click on Show in Explorer option, it will navigate you to the APK generated path like as shown below.
Now you can send this APK file to your GMAIL and open that email, install your APK on the device which you want to run the app.
To install third party APK’s you need to enable unknown app installation permissions in your device. While installing your APK, the device will ask for the permission to install app on your device.
Once you allow the permission to install APK, your app will be installed in your device to perform your operations like as shown below.
This is how we can run or test our android apps on real devices such as mobile / phone, etc. based on our requirements.