When developing an Android app, it is critical to test your application on a real device as well as emulators. This article explains how to configure your development environment and Android-powered device for testing and debugging.
Running Your Android Project in Your Smartphone
- Install the ADB Driver (Only for Windows)
- Connect your Android device to your computer using a USB cable.
- On the device, launch the “Settings” app.
- Scroll all the way to the bottom to find the “About phone” item.
- Scroll all the way to the bottom to find the “Build number” section.
- Tap on “Build Number” seven times in a row.
- The message “You are now a developer!” should appear.
- Return to the main “Settings” page.
- Scroll to the bottom of the page to find the “Developer options” item.
- Turn on the “USB Debugging” switch and press the “OK” button.
- Unplug and reconnect the device
- “Allow USB Debugging?” appears as a dialog box.
- Check the box next to “Always allow from this computer” and then click “OK.”
- We can now run apps from Android Studio on our device:
- Choose one of your projects and press the “Run” button in the toolbar.
- Select the “Choose a running device” radio button in the “Choose Device” window that appears, then select the device and click OK.
- When Gradle is finished building, Android Studio should install and launch the app on your connected device.
References:
https://guides.codepath.com/android/Running-Apps-on-Your-Device#enable-usb-debugging
https://miro.medium.com/max/1400/1*7nKdUlVkd1X6G9_7RN4Btw.jpeg