How to Bundle an iOS Sticker Pack with a Xamarin Forms Application

I had a client request to include an iOS Sticker Pack, or iMessage extension, with a Xamarin Forms iOS application. At first it seemed impossible, but after a lot of trial and error with the Ice Cream Builder sample project, I was able to bundle the stickers in the project. Meaning, when a user installs my iOS app, the sticker pack is installed at the same time. This blog post will explain how to bundle a simple iMessage extension with your application that displays a bunch of stickers (GIF & PNG). This blog post assumes you are using Visual Studio to develop your Xamarin iOS application.

Getting Started

Bundling an iMessage app with your main Xamarin.iOS app is actually really simple. Start by adding a new iMessage extension to your solution, as you would normally do for any other type of project (right click solution -> Add… -> New Project). If you don’t see an iMessage extension, you may not have included the necessary project types when installing Visual Studio (I think it comes with the Xamarin package, but I’m not 100% sure).

Continue reading “How to Bundle an iOS Sticker Pack with a Xamarin Forms Application”

Advertisements

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.

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.