Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms Visual Studio 2017 project does not deploy

I am new to Xamarin. I used Xamarin. Forms template to create a sample mobile solution in Visual Studio 2017. The process created four projects Xamarin PCL, Xamarin Android, Xamarin.iOS and Xamarin.UWP. Without making any modification to the generated solution, I am trying to run it.

The first issue is, when I set the UWP as the starting project, the Windows emulator shows up and runs the app perfectly. But when I try to do the same with Android, I get different errors at different times based on the environment changes I make. Finally, using the visual studio android emulator, the Phone UI shows up but not my app. In the background, I can see that Visual Studio completed the build process successfully without any errors but the deploy process simply hangs. I left the deploy running overnight but still running in the morning. Here is my environment.

  • Intel Core i7 processor
  • Virtualization enabled in BIOS
  • Windows 10 Education
  • 32GB RAM
  • Hyper-V disabled in Windows
  • Executed bcdedit /set hypervisorlaunchtype off in the command window and rebooted.

I tried setting the above environment in different combinations but none of them seem to make the app work. When I use an android emulator from android SDK, the build process throws errors. The only emulator that even builds is the visual studio emulator. But the deploy hangs.

A second issue I have is, I have installed android SDK for version 24 and 25. But in the emulator dropdown, I can only see the emulators for 23. I checked the installation path both in visual studio and android SDK manager and they both point to the same installation folder. What do I need to make the emulators for version 24 and 25 usable?

I repeat, I did not make any change to the generated solution in visual studio before running it. I have been at it for the past three days and couldn't make it work. Please help.

like image 926
Babu Mannavalappil Avatar asked Apr 11 '17 11:04

Babu Mannavalappil


1 Answers

I just installed Visual Studio 2017 (on Win10 15063.138) and found, like you, Xamarin projects won't deploy to Android. Here's how I got running:

  • Updated everything in the Android SDK Manager.
  • Installed the new, improved Android Emulator from MS: https://www.visualstudio.com/vs/msft-android-emulator/
  • Used that to download/install an API level 23 (6.0 Marshmallow) emulator
  • Started that emulator using the same tool (you'll see it running in Hyper-V Manager)
  • Selected same emulator in VS for deploy/debug (the emulators that ship with VS are painfully slow)
  • In VS, selected Android project for start-up and verified build and deploy to Android in build config mgr.

Note: MS doesn't appear to have any emulators above API level 23, so Compilation and Target settings for your Android project can be the latest, but the minimum target will have to be 6.0 (API 23).

like image 144
Ryan Russon Avatar answered Sep 30 '22 20:09

Ryan Russon