Flutter — Issues With Migrating to the New Crashlytics SDK? Try These Steps

Rob Jones
4 min readNov 14, 2020
The email sent regarding the deprecation of Fabric Crashlytics on November 15, 2020

You’re probably upgrading because you’ve been getting those emails from Google about the Fabric Crashlytics deprecation occurring on November 15, 2020. If you’re running into some problems while upgrading, try the steps listed here.

Step 1 — Follow the Migration Guide

If you are just beginning the upgrade, skip this article and follow the Migration Guide. Following that guide should solve 99 percent of the problems you’ll encounter if you try to migrate without guidance.

Keep in mind that once you upgrade the Crashlytics plugin, you will likely see a host of problems occur due to other incompatible Firebase plugins. So upgrading Crashlytics most likely won’t be as simple as just updating your pubspec.yaml and changing the syntax in your code regarding Crashlytics. Instead of following the trail of error codes you get after upgrading the Crashlytics plugin, just follow the guide and do it all at once.

Step 2 — Check the pub.dev pages for any plugins you updated

If you completed Step 1 for all of your plugins listed in the Migration Guide and are still encountering some issues, go to the pub.dev pages for those plugins and be sure you have followed the setup instructions there as well.

Tip: Getting the “No Firebase App ‘[DEFAULT]’ has been created — call Firebase.initializeApp()” error? Change your main function to this:

import 'package:firebase_core/firebase_core.dart';void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
///Any other inits you need///
runApp(MyApp());
}

See this question on StackOverflow for more information:

Step 3 — Still Getting Errors?

In my personal experience, I did not encounter any real issues with the Android side of things after upgrading Crashlytics and the other Firebase plugins. Aside from having to change some code for Firebase calls, no strange errors or problems occurred.

The main “issue ” I ran into was changing over the Firestore/Firebase authentication calls and their syntax. You can see what was replaced by going to the plugin’s pub.dev page under the “Changelog” section and searching for the new syntax:

Changelog page for cloud_firestore showing what new methods are called
Example of the cloud_firestore Changelog — CTRL/CMD + F on the page to find what you need to change

The iOS side of things didn’t go as smoothly.

If you are getting iOS errors:

  • Run flutter clean
  • Go back to Step 1 and make sure you followed the steps in the Migration Guide that are specific to iOS in reference to each plugin
  • Go back to Step 2 and make sure you followed the steps on the pub.dev pages that are specific to iOS of any plugins you updated
  • Go to the iOS section of the Crashlytics docs page and follow those few steps
  • Getting CocoaPods errors? Go to the bottom of the Migration Guide under the “Common Upgrade Issues” section and follow the steps on deleting your Podfile.lock file and updating your pod specs repository
  • Still Getting CocoaPods errors? Check out this solution on GitHub regarding deleting the ios/Pods directory: https://github.com/flutter/flutter/issues/32400#issuecomment-491546704
  • Are you using the plugin admob_flutter? If so, you will get Podfile errors if you have too old of a version. Update your admob_flutter in your pubspec.yaml and follow the setup steps on the pub.dev page as usual
  • Still no luck? Be sure you are thoroughly looking through your error output on the console. The actual problem may not be what you see on the very last line thrown at you. When you scroll through it, you should see more information up above:
iOS error console output

You can see here that the last line says “Error running pod install,” and you could spend a whole day trying to Google what causes that. Right above, CocoaPods says that it’s an issue with the version number in the Podfile, but fixing that won’t stop this error from occurring. Instead, when you look further up the output, you can see the actual issue involved a CocoaPods error regarding “nanopb” (which ended up being related to the admob_flutter plugin, see above).

I hope something here solved your problem. If you ran into another issue while migrating to the new Crashlytics SDK, feel free to reach out and I’ll add it to this article. As always, good luck.

--

--