Xamarin: Finally compiled a C# program and ran it on an emulator

After about 20 hours of downloading Xamarin and Android SDKs (see here) I finally got VS2015 (apparently) able to compile C# code into an Android program. Remember that the native language of Android is Java, so Xamarin cleverly converts from C# to Java. Anyway the download and install carried on apparently without errors and with a condesceding message from the programmer in the dialog box:

"Don't worry we've got this. Why not do some tutorials while you wait?"

I hate it when programmers talk to the public in that "I'm friendly but I know better than you" tone. Or even like this. Or this

Despite my cynicism the download and install completed without error. So I could start the tutorial (again).

I followed the tutorial. There were a few mis-steps, but I noticed immediately that I felt at home, I knew my way around VS2015, while Android Studio was a new beast. As I saw the fragments of C# my annoyance at the huge Xamarin download began to float away.

I got these errors as I trundled along, for example: "This project contains resources that were not compiled":

Hmm. Ah. Does it? I'd followed the tutorial, so why the message? I closed the project and re-opened it, and all was well. Ah. Hmmm.

Then: "String types not allowed (at id with value..."

I was completely baffled by this one, and only a Google search for the exact phrase could resolve the question. I'd used " @+id/TranslateButton" instead of "@+id/TranslateButton". Spot the difference. There is a leading space in my erroneous version. My fault.

Once when I tried to open the layout of the screen I got a "Incorrect parameter" message box. Ok. Tried again and it worked. It feels like lots of complex, delicate and not bug free stuff is running around behind the scenes. Nervous making.

Then, after changing target Android versions (a slightly scary nightmare in itself) I got the "For some reason we could not reload the project." message:

"For some reason..."? "For some reason..."? What does that mean? It's a bit like the "Something went wrong" message I talked about in the previous post. The programmer who wrote that message...he's found out there's an error, but can't understand what it is. Hmmm.

Luckily since I'd already tested Android Studio the Android emulator was installed.  But it crashed or my program crashed or "something else went wrong" to use the technical gergo of Xamarin. Eventually, after fiddling around with SDK versions and emulated phones I got the Phone Word app to run. It crashed in the end, I think because I tried to phone from the emulator, and the emulator can't do that.

So...so I'm not used to getting errors like this in VS2015, C++ and C# for Windows. But I found myself anyway more comfortable in this more error prone environment than in Android Studio. 

So I'll probably stick to Xamarin in VS until I can see a compelling reason to change.


Popular posts from this blog

Lithophanes, I can only learn by experience.

How I don't learn from experience

Go! Stop! Stroop!