Test on an Android device or emulator

There are several ways to test and debug your Mechanical man application program victimisation a real device or copycat on your Windows machine. We have outlined a few recommendations in this guide.

Keep going a real Mechanical man device

To run your app on a real Android device, you will first take to enable your Mechanical man device for developing. Developer options on Android have been hidden past default since version 4.2 and enabling them can deviate supported connected the Android version.

Enable your gimmick for development

For a gimmick running a modern version of Android 9.0+:

  1. Connect your device to your Windows development machine with a USB cable. You may receive a notification to instal a USB driver.
  2. Open the Settings screen happening your Mechanical man gimmick.
  3. Select About phone.
  4. Whorl to the bum and dab Build number seven multiplication, until You are now a developer! is visible.
  5. Rejoinder to the past screen, select System.
  6. Select Late, whorl to the prat, and tap Developer options.
  7. In the Developer options window, scroll down to find and enable USB debugging.

For a twist running an aged interlingual rendition of Android, see Set Up Device for Developing.

Run your app happening the twist

  1. In the Android Studio toolbar, pick out your app from the run configurations shake off-down menu.

    Android Studio Run Configuration menu

  2. From the object device drop-down menu, select the device that you deprivation to ravel your app on.

    Android Studio Target Device menu

  3. Select Die hard ▷. This will launching the app on your connected device.

Run your app along a virtual Android gimmick exploitation an imitator

The first affair to know roughly running an Humanoid imitator on your Windows machine is that regardless of your IDE (Mechanical man Studio, Visual Studio, etc), emulator performance is vastly improved by enabling virtualization support.

Enable virtualization support

Earlier creating a virtual device with the Android emulator, IT is recommended that you enable virtualization past 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 data processor essential:

  • Make 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 whitethorn be able to rill Intel HAXM or AMD Hypervisor. For more info, see the article: Hardware acceleration for emulator performance surgery the Mechanical man Studio Emulator software documentation.

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

    Hyper-V requirements from systeminfo in command prompt

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

  3. Formerly 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. Resume your computer when prompted.

Emulator for native development with Android Studio apartment

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

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

    Android Studio Run Configuration menu

  2. From the target twist cliff-down menu, take the gimmick that you want to hunt your app happening.

    Android Studio Target Device menu

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

Tip

At one time your app is installed on the copycat gimmick, you bottom manipulation Apply Changes to deploy certain code and resource changes without building a new APK. See the Android developer guide for more entropy.

Emulator for cross-program development with Visual Studio

There are many Mechanical man emulator options available for Windows PCs. We urge using the Google Android emulator, arsenic information technology offers access to the fashionable Android OS images and Google Encounter services.

Install Android copycat with Visual Studio apartment

  1. If you assume't already take it installed, download Visual Studio 2022. Use the Visible Studio Installer to Modify your workloads and secure that you have the Mobile development with .Clear workload.

  2. Produce a new project. One time you've set up the Android Emulator, you give the axe use the Android Gimmick Manager to create, double, customize, and launch a miscellanea of Mechanical man realistic devices. Found the Android Gimmick Manager from the Tools menu with: Tools > Humanoid > Android Device Manager.

  3. Once the Android Device Director opens, select + New to create a new gimmick.

  4. You will need to give the device a diagnose, choose the base device type from a drop-down menu, prefer a CPU, and OS version, on with several other variables for the essential device. For more info, Humanoid Device Manager Main Screen.

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

    Visual Studio launch Android Emulator

Additive resources

  • Originate Plural-screen apps for Android and get the Surface Duo device SDK

  • Add Windows Defender exclusions to improve performance