Do you work with .NET Core updates?
Take a quick survey to help us improve your experience with acquiring .NET Core updates.

Xamarin Tutorial - Hello World in 10 minutes

Configure device

To develop with your Android device, USB debugging needs to be enabled. Follow these steps on the device to connect it to Visual Studio. If you do not have an Android device, skip below to emulator setup instructions.

Enable developer mode

  1. Go to the Settings screen
  2. Find Build number by using search at the top of the settings screen, or locate it in About phone
  3. Tap Build number 7-10 times until "You are now a developer!" pops up
  4. Click Create

Android device's settings screen on the about phone screen displaying build number.

Check USB debugging status

  1. Go to the Settings screen.
  2. Find USB debugging by using search at the top of the settings screen, or locate it in Developer options.
  3. Enable USB debugging if it isn't enabled already.

Android device's settings screen on the about developer settings screen displaying USB debugging option that is turned on.

Trust device

  1. Plug your device into your computer
  2. You will be prompted to Allow USB debugging
  3. Check Always allow from this computer
  4. Click Allow

Android device prompt to allow USB debugging on the device from the computer.

Your device is now configured and will show up in Visual Studio as a deployment target.

Having issues? Check the documentation.

Setup Android emulator

If you don't have a device to deploy to, you'll need to setup an Android emulator or use a device. If you've already done this, you can skip this step.

If this if your first time building a Xamarin application, you'll need to create a new Android Emulator. You'll see "Android Emulator" in the debug menu. Click it to start the creation process.

Visual Studio 2019 toolbar menu showing 'Android Emulator' as the debug target.

This brings up a UAC prompt to be accepted and then the emulator creation process. The options are automatically populated for a base emulator. If required, change any options and then select Create.

Dialog to create a new Android emulator with default settings populated.

At this point, you may be prompted to agree to the license agreement for the Android emulator. Read through and select Accept to continue the process. This will download the emulator images and finalize the creation of the emulator for use in Visual Studio.

Once the emulator has been created, you'll see a button that says Start. Click it.

Android emulator manager showing that the emulator has been created and ready to run.

You may receive prompt to enable Windows Hypervisor Platform. Follow the documentation to enable this feature for optimal performance.

Prompt to enable Windows Hypervisor Platform

The Android emulator will launch. Wait for it to fully finish starting and you'll see it displayed in the Visual Studio debug menu.

Visual Studio 2019 toolbar menu showing the newly created Android emulator as a debug target.

Your Android emulator has now been created and is ready to use. Next time you run Visual Studio, the emulator will appear directly in the debug target window and will start when you select it. If you ran into any issues or have performance issues with the emulator, read through the full setup documentation.

If you don't have a device to deploy to, you'll need to setup an Android emulator or device. If you've already done this or only wish to deploy to iOS, you can skip this step.

If this if your first time building a Xamarin application, you'll need to create a new Android Emulator. You'll see "Select Device" in the debug menu. Click the run button to start the creation process.

Visual Studio for Mac toolbar menu showing 'Select Device' as the debug target.

You are now prompted to verify you'd like to create an emulator. Click Add a Virtual Device:

Visual Studio for Mac prompt showing confirmation to add a virtual device.

This opens the Android Device Manager. Click + New Device to start the creation process.

Android Device Manager that is blank with an option to create a new device.

The options are automatically populated for a base emulator. If required, change any options and then select Create.

Dialog to create a new Android emulator with default settings populated.

At this point, you may be prompted to agree to the license agreement for the Android emulator. Read through and select Accept to continue the process. This will download the emulator images and finalize the creation of the emulator for use in Visual Studio.

Android emulator manager showing that the emulator has been created and ready to run.

Once the emulator has been created, you'll see a button that says Play. Click it and the Android emulator will launch. Wait for it to fully finish starting and you'll see it displayed in the Visual Studio debug menu.

Visual Studio for Mac toolbar menu showing the newly created Android emulator as a debug target.

Your Android emulator has now been created and is ready to use. Next time you run Visual Studio, the emulator will appear directly in the debug target window and will start when you select it. If you ran into any issues or have performance issues with the emulator, read through the full setup documentation.

Your emulator or device should now be configured for deployment!

Continue