Test on an Android device or emulator (2023)

  • Article
  • 4 minutes to read

There are several ways to test and debug your Android application using a real device or emulator on your Windows machine. We have outlined a few recommendations in this guide.

Run on a real Android device

To run your app on a real Android device, you will first need to enable your Android device for development. Developer options on Android have been hidden by default since version 4.2 and enabling them can vary based on the Android version.

Enable your device for development

For a device running a recent version of Android 9.0+:

  1. Connect your device to your Windows development machine with a USB cable. You may receive a notification to install a USB driver.
  2. Open the Settings screen on your Android device.
  3. Select About phone.
  4. Scroll to the bottom and tap Build number seven times, until You are now a developer! is visible.
  5. Return to the previous screen, select System.
  6. Select Advanced, scroll to the bottom, and tap Developer options.
  7. In the Developer options window, scroll down to find and enable USB debugging.

For a device running an older version of Android, see Set Up Device for Development.

Run your app on the device

  1. In the Android Studio toolbar, select your app from the run configurations drop-down menu.

    (Video) Which mobile app testing is better? Real device vs Emulator vs Simulator

    Test on an Android device or emulator (1)

  2. From the target device drop-down menu, select the device that you want to run your app on.

    Test on an Android device or emulator (2)

  3. Select Run ▷. This will launch the app on your connected device.

Run your app on a virtual Android device using an emulator

The first thing to know about running an Android emulator on your Windows machine is that regardless of your IDE (Android Studio, Visual Studio, etc), emulator performance is vastly improved by enabling virtualization support.

Enable virtualization support

Before creating a virtual device with the Android emulator, it is recommended that you enable virtualization by turning on the Hyper-V and Windows Hypervisor Platform (WHPX) features. This will allow your computer's processor to significantly improve the execution speed of the emulator.

To run Hyper-V and Windows Hypervisor Platform, your computer must:

(Video) Android App testing with Android Emulator and Burp Suite - Basic Tutorial

  • Have 4GB of memory available
  • Have a 64-bit Intel processor or AMD Ryzen CPU with Second Level Address Translation (SLAT)
  • Be running Windows 10 build 1803+ (Check your build #)
  • Have updated graphics drivers (Device Manager > Display adapters > Update driver)

If your machine doesn't fit this criteria, you may be able to run Intel HAXM or AMD Hypervisor. For more info, see the article: Hardware acceleration for emulator performance or the Android Studio Emulator documentation.

  1. Verify that your computer hardware and software is compatible with Hyper-V by opening a command prompt and entering the command: systeminfo

    Test on an Android device or emulator (3)

  2. In the Windows search box (lower left), enter "windows features". Select Turn Windows features on or off from the search results.

  3. Once the Windows Features list appears, scroll to find Hyper-V (includes both Management Tools and Platform) and Windows Hypervisor Platform, ensure that the box is checked to enable both, then select OK.

  4. Restart your computer when prompted.

Emulator for native development with Android Studio

When building and testing a native Android app, we recommend using Android Studio. Once your app is ready for testing, you can build and run your app by:

(Video) Fastest Android Emulator yet | M1 MacBook test

  1. In the Android Studio toolbar, select your app from the run configurations drop-down menu.

    Test on an Android device or emulator (4)

  2. From the target device drop-down menu, select the device that you want to run your app on.

    Test on an Android device or emulator (5)

  3. Select Run ▷. This will launch the Android Emulator.

Tip

(Video) This Is The BEST $120 Budget Android Phone I’ve Ever Tested!

Once your app is installed on the emulator device, you can use Apply Changes to deploy certain code and resource changes without building a new APK. See the Android developer guide for more information.

Emulator for cross-platform development with Visual Studio

There are many Android emulator options available for Windows PCs. We recommend using the Google Android emulator, as it offers access to the latest Android OS images and Google Play services.

Install Android emulator with Visual Studio

  1. If you don't already have it installed, download Visual Studio 2019. Use the Visual Studio Installer to Modify your workloads and ensure that you have the Mobile development with .NET workload.

  2. Create a new project. Once you've set up the Android Emulator, you can use the Android Device Manager to create, duplicate, customize, and launch a variety of Android virtual devices. Launch the Android Device Manager from the Tools menu with: Tools > Android > Android Device Manager.

  3. Once the Android Device Manager opens, select + New to create a new device.

  4. You will need to give the device a name, choose the base device type from a drop-down menu, choose a processor, and OS version, along with several other variables for the virtual device. For more information, Android Device Manager Main Screen.

  5. In the Visual Studio toolbar, choose between Debug (attaches to the application process running inside the emulator after your app starts) or Release mode (disables the debugger). Then choose a virtual device from the device drop-down menu and select the Play button ▷ to run your application in the emulator.

    (Video) How to Use Phone instead of Android Emulator in Android Studio, Visual Studio Code

    Test on an Android device or emulator (6)

Additional resources

Videos

1. Run/Test your your Android App on a virtual device(Emulator) - 2020
(Android Developers Africa)
2. Emulator Testing Vs Real Device Testing
(Toy Basket)
3. Appium Tutorial 3: What is APK File? What is Simulator,Emulator and Real device?
(SDET- QA Automation Techie)
4. Testing Android and iPhone Without a Device - Unity Device Emulator Setup
(Online Code Coaching)
5. Should You Use an Android Phone for Retro Gaming? (Gamecube, Dreamcast, Saturn, N64)
(Retro Game Corps)
6. 👑 5 BEST Android Emulators for PC
(Kevin Stratvert)
Top Articles
Latest Posts
Article information

Author: Rob Wisoky

Last Updated: 30/03/2023

Views: 5848

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.