comments 2

Getting Started with Xamarin and Visual Studio – My Experience

So I started this webapp using Ruby on Rails and I decided I was going to extend it to an Android app that I would push to the Play Store. All the webapp does so far is handle authentication. In future blog posts I will make the app useful. I chose Xamarin and C# because Xamarin would be new to me and I am seeing Microsoft (Trinidad) offering free training on this. Also Xamarin is designed to create cross platform apps. I asked their twitter account how they came up with the name Xamarin but have gotten no response so far. By the way, Xamarin was acquired by and is a subsidiary of Microsoft.

First thing I did was download Visual Studio Professional 2016 trial. There is also a Community Edition. I chose the default installation option. After installing Visual Studio, I was not sure if Xamarin was a separate download so I just started Visual Studio. Under New Project > Templates > Visual C# there is an option for Android so I selected that. But then it tells me to download Xamarin. It was a huge download. More than 3GB. After installation I got the following error (I am using 64 bit Windows 10 Home Insider Preview)

Program Compatibility Assistant
A digitally signed driver is required
HAXM Driver
Intel Corporation
Windows blocked the installation of a digitally unsigned driver. Uninstall the program or device that uses the driver and check the publisher’s website for a digitally signed version of the driver.

I contacted local company, RCL (Ray Consulting Limited), about this and got the following response,

HAXM is an virtualization engine by intel for your android emulator. Try this

1. Uninstall HAXM using windows ‘Program and Features’
2. Re-install HAXM following this video : https://www.youtube.com/watch?v=Z0kv8hMStmE

There was no entry in Programs and Features (from Control Panel) so I went to step 2. I downloaded HAXM from here and driver signature enforcement overrider from here, as specified by the video. I reached the part in the video where I needed to install HAXM but remeber before I said I didn’t see it to uninstall? Well it’s there but it starts with Intel i.e. Intel Hardware Accelerated Execution Manager. I came to this realisation because I was prompted with this

A version of Intel Hardware Accelerated Execution Manager 6.0.1 is already installed. Do you want to continue to install Intel Hardware Accelerated Execution Manager 6.0.5?

I said No and went and uninstalled it first. The following commands and files were needed in the rest of the video. One thing I did not do was test to see if I would get an error in Visual Studio first.

sc query intelhaxm
sc stop intelhaxm
sc start intelhaxm

C:\Windows\System32\drivers\IntelHaxm.sys
C:\Windows\System32\DRVSTORE\intelhaxm_[ID from your Windows installation]\IntelHaxm.sys

So my aim at this point is to create the look and feel. The functionality will be added once I build the authentication API in the webapp (another blog post). Some useful links : Getting Started with Xamarin Android Modifying the UI and Prebuilt apps. I created a blank project from New > Project > Templates > Visual C# > Android > Blank App (Android). The first thing I wanted to do was add some text boxes and buttons and a toggle menu to my layout. I opened Resources / layout / Main.axml. Then got the following error message.

Something went wrong

The installed Android SDK is too old. Version 25.1.3 or newer is required. Please update to the lastest version.

Actions : Open Android SDK

Simply click the link and do the update. I then got the following warning

SDK Manager : Failed to install

-= Warning ! =-

A folder failed to be moved. On Windows this typically means that a program is using that folder (for example Windows Explorer or your anti-virus software). Please momentarilly close any running programs that might be accessing the directory.

C:\Users\HASSAN~1\AppData\Local\Xamarin\MONOFO~1\ANDROI~1\tools

I had the Visual Studio project with the emulator opened, so I closed those and proceeded (try again button) without error. So far with these posts you are seeing that at times it’s not just download and install and start. Prepare for some errors and troubleshooting to get the environment up and running. God bless the bloggers, youtubers, social media, forums and the likes. How many times do we have to refer to them to get by. When I reloaded the project, the layout loaded correctly but I was presented with a message stating that there was an update for Xamarin. I updated Xamarin and continued. Please share your thoughts and experiences with us in the comments below.

2 Comments

  1. Xamarin can be difficult to install and configure, especially for Android development. However, once you get it going, you will reap the reward for cross-platform development. Try Xamarin.Forms portable project, its very popular.

    Post your project on GitHub, I would be glad to contribute. If you need help with using GitHub from Visual Studio take a look at this : https://channel9.msdn.com/Events/Build/2015/3-746

    Video is 1hr long, could not find a shorter one, sorry.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s