Category Archives: Android

Creating a Xamarin Forms Project – Android SDK Tools

I’m quite new to Xamarin Forms; I’ve managed to get projects working before now, but I find myself stumbling through the same problems again and again. This is one such issue – so, hopefully, now I will come across my own article first!

The Problem

You create a new Xamarin Forms app, press F5 and you get an error similar to this:

Xamarin.Android for Visual Studio requires Android SDK. Please click here to configure.

If you double click this, it should launch the Android SDK Manager.

The Solution

The problem is, in fact, that there are many Android SDKs; so you need to install the correct ones for the systems that you’re targeting. Start with the SDK Manager; if it hasn’t already launched, then launch that here:

Next, have a look in your Xamarin output (that’s the standard output window, just select output from Xamarin in the drop-down):

Okay, so now you know what’s missing. We should now be able to find those versions of the Build Tools in the SDK Manager:

Once you’ve made the changes, select “Apply Changes” at the bottom.

It would be nice if that was it; however, you may have to restart Visual Studio before it realises what you’ve done.

Running an Android App for the first time

Introduction

This is pretty much my first try on Android. I’ve downloaded tools in the past… and even faced one or two of the problems below, but I’ve never really stuck with it and actually run anything. The reason it reads like I don’t know what I’m doing and just flailing around in the dark is because I don’t and I am.

Software

In the past, the Android system has seemed to me, as a Visual Studio Developer, a little scattered. This is definitely still the case, but now less so. Android Studio seems to be the first step into a “download and run” system… but that is still a way off.

Steps

The first thing to do is to download Android Studio. Create a new project and build. You may get none of the following issues, but if you do, then this is how I got around them.

Androidpost1

This appears to be answered by this question. The problem was definitely the same one; when I compiled, I get this error:

C:\Users\Paul\AppData\Local\Android\sdk\tools\emulator.exe -avd MonoForAndroid_API_15 -netspeed full -netdelay none
emulator: ERROR: This AVD’s configuration is missing a kernel file!!

The suggested solution is to install the “ARM EABI v7a System Image”.

androidpost2

I enabled it, however, this did not fix the issue for me.

I then tried running Android Virtual Device Manager:

androidpost3

After creating a new AVD like the Nexus One above, ironically, Android Studio advises you to use x86. So I did… and got this error:

androidpost4

But it’s already installed:

andoidpost5

Weirdly, “Installed” is a misnomer; it doesn’t mean “installed”, it means… err… “not installed”. The way to properly install it is to go to the “extras” directory in explorer and run the installer from there:

androidpost6

I then got this error:

androidpost7

Okay – so this error is caused because you apparently can’t run Hyper-V and the HAXM emulator at the same time. I didn’t want to disable Hyper-V and, having tried several work-arounds, came to the conclusion that whatever the speed implications of not using the HAXM emulator, it was not as bad as having to reboot my machine to switch dev environments. So, I moved to ARM EABI-v7A:

androidpost8

As promised – this is slow! But it works:

androidpost9