In this session, we will walk through different errors which we get while setting up Xamarin with Visual Studio. We will see, what steps we should follow so that we don't get any error and if get any error then how to resolve it. So, below we are going to give you some basic idea what need to do while setting up the Xamarin and  what if we get installation error kind of things or setting up Xamarin with Visual Studio in Windows 10 or what we should need to do if UWP project is missing or how to enable or disable Hyper-v mode. So, these types of problem, we will resolve with this article. So, let's start step by step with this demonstration.

 

Always install Visual Studio directly from the Internet

If you have already installed Visual Studio then you should keep it up to date along with Windows. But if you are planning to install then don’t install it from any downloaded bulk files. Microsoft Visual studio always provides the setup that can be downloaded from Visual Studio’s site. Just download it and run, it will automatically provide you with Visual Studio Installer from where you can choose the required components like Xamarin and all. 

Never try the installation of Visual Studio from an offline installer. If you are planning to install from Offline Installer then make sure, your windows version should be up to date. Otherwise, it will create many issues while creating the Xamarin project. So, it's recommended that always download an installer and install Visual Studio direct from the internet. 

 

Windows 10 with Visual Studio and Xamarin

If you have installed Windows 10 with Visual Studio 2017 along with Xamarin. Then you should keep few things in mind while creating a Xamarin project.

  1. If you are planning to use .Net Standard 1.0 or 2.0 with Xamarin 3.0 or upper version then your Windows 10 version should be 1803.
  2. If you have Windows 10 with version 1607 and if you are creating Xamarin.Forms project with Code Sharing Strategy as “Shared Project” and you have installed Xamarin version 3 or more then it auto converts to .Net Standard 2.0. But while running it will not work because of point number 1.
  3. If you have Windows 10 with version 1607 and you have created one Xamarin.Forms project. As noted above, it auto uses .Net Standard 2.0 and if you want to convert it with Shared Project then use the minimum version of Xamarin.Forms from NuGet.
UWP Project template is missing

At the time of Visual Studio installation, you might forget to check “Universal Windows Platform Development” option or it might have some other reason, so Visual Studio does have UWP template installed. To install from Visual Studio Installer, you have to mark check for “Universal Windows Platform Development” or you can download it from Here.

https://marketplace.visualstudio.com/items?itemName=WASTeamAccount.WindowsTemplateStudio

https://www.visualstudio.com/vs/support/selecting-workloads-visual-studio-2017/

 

Could not find android.jar for API Level xyz.

There could be several reasons for this error.

  1. You might don’t have installed “Android SDK Platform for selected API” level.
  2. Installed “Android SKD Platform for API xyz” has corrupted.

You can do the following things to resolve this issue.

  1. Installed missing “Android SDK Platform for API xyz” from Tools > Android > Android SDK Manager.
  2. Or just copy all the files from the previous API and paste it into missing API. For example, if API-27 is missing then copy all files from API-25 and paste it into API-27 or create the new folder as API-27 similar to API-25 and paste all files from API-25 to API-27

You can find installed Android SDK Platform for API on the below path. This is for API level 25.

C:\Program Files (x86)\Android\android-sdk\platforms\android-25

After installing or creating a copy of the existing API for new API, you should have to change the target API framework with an installed version of that project from the project properties in Visual Studio. 

 

Hyper-V is enable

If your system has enabled Hyper-V then you will not able to use Android Emulator. For using Android Emulator, we have to disable Hyper-V using the command prompt.

For disabling Hyper-V: bcdedit /set hypervisorlaunchtype off

For enabling Hyper-V: bcdedit /set hypervisorlaunchtype auto

Please note here, after performing any operation as above, the system should restart.

 
Missing assembly references for First Time

Sometimes, if you create a new project for Xamarin.Forms then you will find that some of the assembly references are missing for Android, iOS or UWP project. To resolve this issue, we can do the following steps.

  1. Right-click to Solution Explorer and choose “Restore NuGet Packages”.
  2. OR go to one by one project and right click to project and choose “Manage NuGet Packages” and from there you can install or update the required packages.
  3. OR update packages using “Update-Package” command from package manager console.

Conclusion

So, today we have seen the problem we face while working with Xamarin with Visual Studio and Windows 10. We also see how to resolve different issue in simple steps.

I hope this post will help you. Please put your feedback using comment which helps me to improve myself for next post. If you have any doubts please ask your doubts or query in the comment section and If you like this post, please share it with your friends. Thanks