how to start with xamarin forms

Lets get some xamarin.forms basics done and check out how we can emulate this with focus to android. Why android focus? My test phone is based on android. So lets start here with some action. For this we need visual studio (in my case 2017 professional). So we create a new project -> Cross Plattform App (Xamarin) -> Emty App -> Xamarin.Forms -> portable class library (PCL). Just do not think to much about it if you are new to xamarin.

Now I choosed CameraApp.Android to debug things:

So visual studio got some emulator if you just installed the xamarin-part. Problem here is that it is incompatible with hyper-v. So if you do not want to disable hyper-v you should the Visual Studio Android Emulator for example. So check out this. With that you can set up some emulators that work with hyper-v without any further problems. I use the 5” KitKat (4.4) XXHDPI Phone. Install that one and it should look like this:

If you got this you should go for 2 further things to avoid problems with dll-uploading:

  • Go to hyper-v -> your new device -> settings -> processor -> compatibility -> and make sure that you put on the migration to other physical computers.
  • In visual-studio -> solution-explorer -> android solution -> properties -> android-options -> disable fast deployment
  • Update alle nuGet packages

So now we have to start our emulator by using the vs-android-emulator. Here we need to enable developer-mode and maybe usb-debugging. Than start debugging in visual studio and you should see the emulator running your code. If you get problems here you always have to check the output in vs. A lot of problems you can not see as a real fail in vs. But instead you get some information in the output-window. As well if you have trouble make sure that all nuget-packages are updated to the correct/last version. BTW: the last version is not the correct version in any case. And another thing that may can confuse you: Rebuild your solution. Sometimes you have to rebuild your solution to make vs get all new things that you did. However you should see something like this:

Advertisements