Xamarin: XLabs 2.0 iOS IGeolocator Woes

Having completed an Android app using Xamarin.Forms, I was tasked with making the iOS counterpart. Well it’s Xamarin so ‘write once, run everywhere’ right? Haha, ok sure.

This particular issue was pretty confusing but was related to changes in the XLabs breaking changes introduced in v2, in particular this inconspicuous line:

You will have to use DependencyService.Register<>() on your platforms packages to register XLabs Services.

Add this to your app delegate and you should be good to go:

DependencyService.Register<IGeolocator, Geolocator>();

There’s also this issue to watch out for too: https://github.com/XLabs/Xamarin-Forms-Labs/issues/657

Xamarin: aapt.exe exited with code 1

After adding the powered-by-google-on-white.png images to a project I’m working on, I’m suddenly hit with ‘aapt.exe exited with code 1’ whilst building. Did Google just give me some bad images? Nope!


It’s because of the use of the hyphens (-) in the filename. Remove them, rebuild and off you go!


After adding Google Maps support to your Xamarin.Forms solution, you try to build and receive this really helpful error. This seems to be triggered by the addition of the Google Play Services framework. It’s almost as helpful as ‘An Exception Occured’, another one of my favourites.

Luckily for this problem there’s a simple solution, increasing the Java heap size.

In Visual Studio open the project properties for your Android project and navigate to:

Android Options -> Advanced

Set the value of

Java Max Heap Size

to 1G.

P.S. Don’t forget to set this for each of your build configurations, otherwise come release time you’ll be scratching your head again. Or maybe that’s just me…In VS