How to Add Firebase’s Crashlytics to a Xamarin.iOS Project

Recently I’ve been doing some Xamarin development. Today, I had to find a way to add Firebase’s Crashlytics service to a Xamarin.iOS app. Not shockingly, there isn’t a ton of clear and succinct information on how to do this, so hopefully this post helps you.

1. Install NuGet packages.

Install the Xamarin.Firebase.iOS.Crashlytics and Xamarin.Firebase.iOS.Core packages into your Xamarin.iOS project. I don’t think the order of installing them matters, but I installed Crashlytics before Core.

2. Add the GoogleService-Info.plist file to your iOS project.

In your Firebase console, follow the SDK setup instructions until you get to Step 2. Download the .plist file and add it to your iOS project. Click on the file and set the Build Action to Bundle Resource.

3. Add Configure() calls to AppDelegate.

Find the FinishedLaunching() method in your AppDelegate.cs file. In the beginning of this method, put:

Firebase.Core.App.Configure();
Crashlytics.Configure();

You’ll need to add a using statement for Firebase.Crashlytics.

4. Does your iOS app reference the old Fabric Crashlytics? Well..

You need to remove the Fabric API key nodes from your Info.plist, or Crashlytics still won’t see any change. Thanks for Lucas for this answer. Specifically, remove the Fabric key element and the entire dict element after it, which contains the Fabric API key.

Guess what you don’t have to do? Anything to do with CocoaPods.

You’re welcome.

Advertisements

Archiving Android app produces “java.exe exited with code 2” error

Super quick and dirty post about an issue that drove me and another dev crazy for a couple hours. We kept getting this error when trying to archive an Android Xamarin project in Release mode (in Visual Studio 2019), specifically on the signing step:

ERROR: "java.exe" exited with code 2

We noticed a line in the build log which referenced a keystore path that was not a valid path on our machine.

Unload your MyApp.Droid project and edit it. In the Release property group, find the AndroidSigningKeyStore property and make sure it is a valid file path on your machine. If not, don’t update it here. Instead:

  1. Close and reload the project.
  2. Right click the MyApp​.Droid project and click Properties.
  3. On the Android Package Signing tab, check the box to Sign the .APK… and fill in all four fields.
  4. Save the project properties.

Try archiving again and it should (hopefully) work. If not, please add a comment to this post and I may be able to help. I may expand this post with more Google Play console errors and their solutions at some point in the future.

Unable to edit, add or remove renderings from the Presentation Details of standard values

I’ve experienced a problem recently where I would make changes to renderings on the standard values of a template, clicked OK and the changes showed up in the Layout Details window, clicked OK again to finish the update, only to find that the renderings didn’t actually change. This is a really odd issue that probably has something to do with the contents of the __Renderings field.

To solve this problem, I had to delete and re-create the standard values of the item. This always fixes it for me. However, I’m really curious as to what caused the issue in the first place. It doesn’t happen for all Standard values items, only a few here and there. Given my __Renderings field contents (screenshot below), I’m not really sure what happened here, but re-creating the item is a simple enough fix.

blog-rendering-corrupt

Creating a Coveo facet with Sitecore sub-domains and external sites as options

Take this example: you have multiple sub-domains hosted in your Sitecore site, and each one has its own node under Content and its own Home item. You also have various external sites not hosted in Sitecore as completely separate sites. You’re building a search page with Coveo and want to develop a basic facet to list all of your internal sub-domains and external sites so that the end-users can filter pages and content by site. How would one do this? In this blog post, I will explain. Disclaimer: When I did this, I was working with Coveo for Sitecore v4.1 – Hive Framework, so if your version is much different, it’s possible not everything in this post will be accurate. Additionally, please note that the XML/HTML code snippets in this blog post will have the greater than/less than symbols stripped out because WordPress can’t handle those.

Create a Coveo Field for Your Facet

Every new facet you create will need its own field, so let’s create one. This is going to be a string, single-value field representing the name of a particular site (i.e. “Store” or “Marketing”, etc). In your Coveo.SearchProvider.Custom.config file, add a new field entry in the fieldMap/fieldNames node. In my case, my field’s name was aopaSiteName, so that naming convention will be used in other parts of this post as well. Your field entry should look something like this:

fieldType fieldName="aopaSiteName" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" isExternal="true" isFacet="true" /

Note that the field definition has isExternal="true" – this specifies that the field is not a normal Coveo for Sitecore field, so the field name won’t need to be converted. So if you put isExternal="false", your field name will become something like fmyfield99999 instead of just myfield. I suggest you keep this setting true to make development easier. Then, isFacet=true is needed so that this field can be used in a facet.

Continue reading “Creating a Coveo facet with Sitecore sub-domains and external sites as options”