I’m rather impressed. It took me a total of about 5 hours, from install to launch, but I have my first login screen already up and running for iOS, Android, and Windows Phone (not pictured) thanks to Xamarin.

PrayerOdyssey_Simulations

I’ll admit, this is really really exciting for me. I’m using a skill set I already have a good fluency with (C# and XAML) and leveraging it to build native apps across multiple platforms. Since the “heavy logic” is already handled through the API, I’m just building a front end to wire up to it.

Getting things off the ground wasn’t 100% smooth using Xamarin and the Visual Studio plugin, but now that I’m over those hurdles, things are moving a lot smoother. Here are a few quick notes that will hopefully help you along the way.

Install Then Update Libraries

The first time I installed Xamarin for Visual Studio and started a new project, I had a bunch of weird errors about libraries that were missing and objects that didn’t exist. I found out that there are a lot of continuous updates going on with the libraries and the installers aren’t always the newest. I flushed the project, used the NuGet manager to update all my Xamarin libraries, and then started a new project. Problem solved.

There is No Xamarin Build Host Application

You may stumble across some older documentation discussing the launching/configuration of the Xamarin Build Host Application in order to properly compile your iOS app if you’re using a Virtual Machine and Visual Studio. This is no more. Xamarin in Visual Studio is able to connect via SSH to your host machine and do everything you need that way. As long as you’ve configured your networking so that the virtual machine can talk to the host machine, you should be prompted upon first startup of the project to target your Mac machine to building. You can give it your machine name (Bombadil in my case) and you should be set. Note: if you put your virtual machine to sleep, you’ll lose this connection and need to reopen your project in order to make the connection again.

Use Xamarin’s Android Emulator

Xamarin came out with a great Android Player that has recent machines to emulate and can work natively on the Mac. I had fewer complications once I installed this. You simply launch an emulator, then use the ADB console to connect to the machine via IP address (easily viewable from settings). From there, Visual Studio will detect the device and make it a deployable target. Far less hassle than the default ADB emulator in Windows.

Start Simple

You can go to the Xamarin website and get a lot of prebuilt applications to use as a demo and springboard for your project. I grabbed one of them and started to copy/paste files and code into my solution to speed through things. However, I started running into some compile issues because Visual Studio does some extra work sometimes when you add a new file through their wizard. Similarly, to really get things off the ground to start testing MY app, I would have had to build in too many resources and get lost in too many side things other than starting with the basics of my app. So I started from scratch. I started walking through the developer guide with basic XAML. The guide is great, and slowly grows your app from the basics to a MVVM recommended architecture. Working through it this way, I’m building out my app, and able to work on the important pieces without things getting bogged down. Later on I’ll go back to my sample code and piece in anything I still need/want.

Now Go Code!

Xamarin is proving to be just as great as I was hoping it to be. I’m looking forward to build out Prayer Odyssey in it’s mobile native form! Feel free to pass on any tricks you may have.

References

https://www.macaw.nl/weblog/2014/11/why-and-how-to-get-started-with-visual-studio-2015-and-xamarin-forms

http://motzcod.es/post/100735916227/debug-with-the-xamarin-android-player-from-visual

https://developer.xamarin.com/guides/ios/getting_started/installation/windows/troubleshooting/

https://developer.xamarin.com

Advertisements

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