Chapter 1. Xamarin Setup

Xamarin has finally given us the power to develop native iOS, Android, and Mac applications in C#, which is one of our favorite programming languages. There are many advantages of choosing Xamarin to develop mobile applications instead of Java and Objective-C. You can share code between multiple platforms and can be more productive by taking advantage of the advanced language features of C# and the .NET base class libraries. Alternatively, you would have to write the app twice for Android and iOS and lose the benefits of garbage collection in iOS.

In comparison to other techniques of developing cross platform applications with JavaScript and HTML, Xamarin also has some distinct advantages. C# is generally more performant than JavaScript, and Xamarin gives developers direct access to the native APIs on each platform. This allows Xamarin applications to have a native look and perform in a manner similar to their Java or Objective-C counterparts.

Xamarin's tooling works by compiling your C# into a native ARM executable that can be packaged as an iOS or Android application. It bundles a stripped-down version of the Mono runtime with your application that only includes the features of the base class libraries your app uses.

In this chapter, we'll set up everything you need to get started on developing with Xamarin. By the end of the chapter, we'll have all the proper SDKs and tools installed and all the developer accounts needed for app store submission.

In this chapter, we will cover:

  • An introduction to Xamarin tools and technology
  • Installing Xcode, Apple's IDE
  • Setting up all Xamarin tools and software
  • Setting up the Android emulator
  • Enrolling in the iOS Developer Program
  • Registering for Google Play

The Xamarin tools

Xamarin has developed three core products for developing cross-platform applications:Xamarin Studio (formerly MonoDevelop), Xamarin.iOS (formerly MonoTouch), and Xamarin.Android (formerly Mono for Android). These tools allow developers to leverage the native libraries on iOS and Android and are built on the Mono runtime.

Mono, an open source implementation of C# and the .NET framework, was originally developed by Novell to be used on Linux operating systems. Since iOS and Android are similarly based on Linux, Novell was able to develop MonoTouch and Mono for Android as products to target the new mobile platforms. Shortly after their release, another company acquired Novell, and let the Mono team go. Very shortly after, Xamarin was founded to focus completely on these tools for developing with C# on iOS and Android.

Getting a development machine ready for developing cross-platform application development can take some time. And to make matters worse, Apple and Google both have their own requirements for development on their respective platforms. Let's go over what needs to be installed on your machine.

To get started on iOS, we'll need to install the following:

  • Xcode: Apple's core IDE for developing iOS and Mac applications in Objective-C
  • Xcode Command Line Tools: These are installed inside Xcode, and provide common Command Line Tools and scripting languages that developers would find useful, such as Subversion or SVN, Git, Perl, Ruby.
  • The Mono runtime for Mac: This is required for compiling and running C# programs on OS X
  • Xamarin.iOS: This is Xamarin's core product for iOS development

Android also requires the following software to be installed to get started:

  • Java: This is the core runtime for running Java applications on OS X
  • Android SDK: This contains Google's standard SDK, device drivers, and emulators for native Android development
  • The Mono runtime for Mac: This is required for compiling and running C# programs on OS X
  • Xamarin.Android: This is Xamarin's core product for Android development

Each of these will take some time to download and install. If you can access a fast internet connection, it will help speed up the installation and set up process. With everything ready to go, let's move ahead step by step, and hopefully, we can skip a few dead ends you might otherwise run into.

Tip

It is important to note that Xamarin can also be used on Windows and Visual Studio, even though it is not covered in this book. A Mac is required for iOS development, so Windows developers must connect Visual Studio to a Mac to compile for iOS. Luckily, most of what we learn in this book can be directly applied to using Xamarin on Windows.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.210