Whether you want to make Google maps related app, or Google+ related app or even add Google Analytics based app, you need to use Google Play Services.
In my case, I wanted to implemented Google Analytics Tracking in one of my Xamarin Android based apps, where as I went through some confusing-not-so-easy set of steps to successfully add Google Play Services in to my project…
Now there is a nice introduction into Xamarin Android based Google Play Services posted by Xamarin Blog, but still it doesn’t cover the aspect of Visual Studio, and frankly it doesn’t tell you how to tackle the common issues you face when you add the Google Play Services Component into your project. 🙂
So here I am sharing my experience on how to add Google Play Services component into your Xamarin Android project with ease and successfully solve the set of common issues you face. 😉
Stuff you need to have,
– Visual Studio 2013 based Xamarin.Android project
– Installed NuGet in your Visual Studio 2013
– Make sure your Xamarin version is up to date in your project
– Make sure you have “Google Play Services” libraries installed in your Android SDK setup and if so make sure it is up to date…
If you have all the above fulfilled, then lets begin…. 🙂
First of all go to your Nuget package manager,
Type in “Google Play Services” in the online search box,
Easy peasy, now go ahead and install…. 😛
Owwhhh BAMMMM ! 😦 Yep, been there buddy.. not to worry, lemme show you how to resolve that.. 🙂
Could not install package ‘Xamarin.Android.Support.v7.AppCompat 184.108.40.206’. You are trying to install this package into a project that targets ‘MonoAndroid,Version=v2.2’, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
To resolve this go to your project Properties -> Application Tab
Now change the Android compile version to any other version except for the “Use Latest Platform (…..)” ! this seem to be a bug in Visual Studio integration..
Save the project and restart Visual Studio ! Once the project is reloaded, try adding “Google Play Services” in nuget again, and it should work like a charm !
Now that’s resolved, everything should be alright yeah ? So go ahead and BUILD the project… 😉
OUCH !!!!! REBUILD ALL FAILED ! 😦
‘COMPILETODALVIK : UNEXPECTED TOP-LEVEL ERROR’
And once again, been there.. 😉 Follow me son..
This is actually a bug in the Configuration, where as it is documented in the Xamarin Knowledge base as well,
To resolve this issue, again go to project Properties -> Android Options tab -> Advanced tab
Change the Java Max Heap Size to 1G 🙂
Now that’s done, go ahead and REBUILD the project..
There you go ! BA DUMM TSSS ! You are all good to go…. 😀 Now you may go ahead and implement any awesome feature you want based on Google Play Services.
Hope this saved you a lot of time and frustration… 😉
Happy coding folks ! 😀