Sunday, June 29, 2014

Xamarin Android ZipAlign not found

After installing, latest Android SDK Tools(Android L Developer Preview), Platform-tools, and Build-tools, you will not be able to run Xamarin Android projects.

Error MSB6004: The specified task executable location "C:\Users\admin\AppData\Local\Android\android-sdk\\tools\zipalign.exe" is invalid.


The latest SDK release from Google moved some things around.

Work around for this issue is by copying zipalign from the build-tools\20.0.0 directory to the tools directory.

Tuesday, June 24, 2014

Portable Class Library(PCL) setup for Visual Studio

Below are the steps to make PCL work in Visual Studio.

*Make sure you install in same order

Steps to setup PCL for Visual Studio
  • Download and install PortableLibraryTools2 (It contains)
    • PCL 4.0 profiles: 104, 131, 14, 18, 19, 1, 23, 24, 2, 36, 37, 3, 41, 42, 46, 47, 4, 5, 6, 88, 95, 96
    • PCL 4.5 profiles: 7
    • PCL 4.0 and 4.5
    • MSBuild targets
  • Extract the (from C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6\ into the PCL reference assemblies directory C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable.

Note: If you have already installed Xamarin for Windows, we need to reinstall Xamarin.Android to get the SupportedFramework files.

Monday, June 23, 2014

What is Xamarin? - Part I

Xamarin is one of the best cross-platform development tool that allows us to create apps in C# for Android, iOS, Windows and Mac. Xamarin is best known as the company behind Mono.

Xamarin is the company sponsoring mono development and support. Commercial products based on mono are Xamarin.iOS(MonoTouch) and Xamarin.Android(MonoAndroid) for developing cross platform mobile applications.

"Xamarin was founded with a mission to delight developers with the world's best platform for mobile development" said Nat Friedman, Xamarin founder and CEO.

What is Mono?

Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime.

Mono runs on multiple platforms - Linux, OS X, BSD, iPhone, Android, PlayStation 3, Wii, Xbox 360, and Microsoft Windows, including x86, x86-64, ARM, s390, PowerPC, SPARC, IA64, MIPS and much more

How did Xamarin got its name?

Just as mono means monkey in spanish,  Xamarin derives its name from a Spanish term for Tamarin species.

What is Xamarin ?

Xamarin enables developers to reach all major mobile platforms
  • Native User Interface
  • Native Performance
  • Shared Code Across Platforms
  • C# & .NET Framework

Why Xamarin?

- Xamarin provides full access to the Native platform APIs from C#.

- Xamarin compiler outputs native executable and packaged as iOS or Android app.  As a result the performance of the applications built by the Xamarin Mono is very high.
- Native compilation gives users brilliant app performance for even the most demanding scenarios, like high frame rate gaming and complex data visualizations.
- Write Everything in C#
- Over a Decade of Enterprise Production Use
- Xamarin offers 100% API coverage on iOS and Android
- Take advantage of everything great about C# and now write code that can be shared across all platforms
  • iOS
  • Android,
  • Mac
  • Windows (WPF, Store, Phone, ASP.NET, etc)

"With Xamarin, developers combine all of the productivity benefits of C#, Visual Studio 2013 and Windows Azure with the flexibility to quickly build for multiple device targets." said S. Somasegar, Corporate Vice President, Microsoft.

Xamarin History

Checkout Part II

Saturday, June 21, 2014

How do I embed/bundle assemblies in native code?

Bundling the assemblies into native shared library, helps to keep your code safe.

1) Requires an Enterprise License.
2) Should install and map Android NDK to IDE.

Xamarin Studio Users:

Xamarin Studio -> Android Projects -> Project Options -> Android Build

Check/ Uncheck  - Embed assemblies in native code

Visual Studio Users:
Android Project -> Properties - > Android Options

Check/ Uncheck  - Bundle assemblies in native code

How do I preserve application data/cache on device/emulator between deployments?

Preserve application data/cache on device/emulator between deployments

Xamarin Studio Users:

Xamarin Studio -> Preferences -> Projects -> Android

Check/ Uncheck  - Preserve data/cache between application deploys

Visual Studio Users:
Tools -> Options -> Xamarin
Check/Uncheck - Preserve application data/cache on device between deploys

*If Xamarin option is not available then click on Show all settings check box in Options window