All Projects → kiwi-bop → Flutter_crashlytics

kiwi-bop / Flutter_crashlytics

Licence: bsd-2-clause
📦 Flutter plugin for Crashlytics integration

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Flutter crashlytics

CrashlyticsKit
The most powerful, yet lightest weight crash reporting solution for Unreal Engine 4
Stars: ✭ 25 (-87.05%)
Mutual labels:  crash-reporting, crashlytics
Flutter Native State
Flutter plugin to help restoring state after the app process was killed
Stars: ✭ 185 (-4.15%)
Mutual labels:  flutter-plugin
Bugsnag Go
Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
Stars: ✭ 155 (-19.69%)
Mutual labels:  crash-reporting
Countrycodepicker
A flutter package for showing a country code selector.
Stars: ✭ 170 (-11.92%)
Mutual labels:  flutter-plugin
Gsy flutter demo
Flutter 不同于 GSYGithubAppFlutter 完整项目,本项目将逐步完善各种 Flutter 独立例子,方便新手学习上手和小问题方案解决。 目前开始逐步补全完善,主要提供一些有用或者有趣的例子,如果你也有好例子,欢迎提交 PR 。
Stars: ✭ 2,140 (+1008.81%)
Mutual labels:  flutter-plugin
Plcrashreporter
Reliable, open-source crash reporting for iOS, macOS and tvOS
Stars: ✭ 2,320 (+1102.07%)
Mutual labels:  crash-reporting
Flutter reactive ble
Flutter library that handles BLE operations for multiple devices.
Stars: ✭ 155 (-19.69%)
Mutual labels:  flutter-plugin
Flutter spinkit
✨ A collection of loading indicators animated with flutter. Heavily Inspired by http://tobiasahlin.com/spinkit.
Stars: ✭ 2,411 (+1149.22%)
Mutual labels:  flutter-plugin
R upgrade
🆙🚀 Flutter application upgrade / download Plug-in (with notice bar progress), supports full upgrade, hot update and incremental upgrade
Stars: ✭ 177 (-8.29%)
Mutual labels:  flutter-plugin
Flutter socket io
Socket IO supprt for flutter. Looking for contributors Swift and Java.
Stars: ✭ 170 (-11.92%)
Mutual labels:  flutter-plugin
Sentry Telegram
Plugin for Sentry which allows sending notification via Telegram messenger.
Stars: ✭ 168 (-12.95%)
Mutual labels:  crash-reporting
Background locator
A Flutter plugin for updating location in background.
Stars: ✭ 162 (-16.06%)
Mutual labels:  flutter-plugin
Opengit flutter
OpenGit基于Flutter的Github客户端,支持Android和iOS。项目中涉及到BloC、Redux、国际化、多主题以及Github相关信息的查看等。
Stars: ✭ 173 (-10.36%)
Mutual labels:  flutter-plugin
Flutter vpn
Plugin to access VPN service for Flutter | Flutter 的 VPN 插件
Stars: ✭ 158 (-18.13%)
Mutual labels:  flutter-plugin
Xcrash
🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
Stars: ✭ 2,689 (+1293.26%)
Mutual labels:  crash-reporting
Flutter wordpress
Flutter WordPress API
Stars: ✭ 155 (-19.69%)
Mutual labels:  flutter-plugin
Bugsnag Cocoa
Bugsnag crash reporting for iOS, macOS and tvOS apps
Stars: ✭ 167 (-13.47%)
Mutual labels:  crash-reporting
Exceptionless
Exceptionless server and jobs
Stars: ✭ 2,107 (+991.71%)
Mutual labels:  crash-reporting
Android Studio Plugins
This is a list of all awesome and useful android studio plugins.
Stars: ✭ 2,186 (+1032.64%)
Mutual labels:  flutter-plugin
Camera awesome
A flutter plugin to handle Android / iOS camera
Stars: ✭ 186 (-3.63%)
Mutual labels:  flutter-plugin

flutter_crashlytics

pub package

Flutter plugin to enable Crashlytics reporting.

Setup

Firebase Crashlytics

If you're using Firebase instead of Fabric, you must first setup your app to use Firebase as per this tutorial. https://codelabs.developers.google.com/codelabs/flutter-firebase/#4

The instructions are the same for Fabric and Firebase, except that for Firebase, you don't get an API key so you don't have to add it anywhere.

Android

To setup Crashlytics on Android side, you need to set the Fabric ID in your manifest like this: (Only do this if using Fabric, not Firebase as you will not have an API Key)

 <meta-data
            android:name="io.fabric.ApiKey"
            android:value="YOUR_ID_HERE" />

You also need to change your build.gradle file like this:

buildscript {
    repositories {
        ...
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
        ...
    }
}

And apply the fabric plugin apply plugin: 'io.fabric'

Nothing more.

Symbolicating Native Android Crashes

Unfortunately, even pure Dart projects can't always protect you from native crashes. Without the following setup, a native crash like SIGSEGV will appear as a blank stacktrace in Crashlytics. Here's how to get some symbols:

Add the following to build.gradle, after apply plugin: 'io.fabric':

crashlytics {
    enableNdk true
    androidNdkOut "../../debugSymbols"
    androidNdkLibsOut "../../build/app/intermediates/transforms/stripDebugSymbol/release/0/lib"
}

Ensure that the NDK bundle is installed or the stripDebugSymbol directory won't get created.

Now setup a release script to populate the debugSymbols directory, guided by the instructions from https://github.com/flutter/flutter/wiki/Crashes

# Build our app like usual
flutter -v build apk --release

### BEGIN MODIFICATIONS

# Copy mergeJniLibs to debugSymbols
cp -R ./build/app/intermediates/transforms/mergeJniLibs/release/0/lib debugSymbols

# The libflutter.so here is the same as in the artifacts.zip found with symbols.zip
cd debugSymbols/armeabi-v7a

# Download the corresponding libflutter.so with debug symbols
ENGINE_VERSION=`cat $HOME/flutter/bin/internal/engine.version`
gsutil cp gs://flutter_infra/flutter/${ENGINE_VERSION}/android-arm-release/symbols.zip .

# Replace libflutter.so
unzip -o symbols.zip
rm -rf symbols.zip

# Upload symbols to Crashlytics
cd ../../android
./gradlew crashlyticsUploadSymbolsRelease

### END MODIFICATIONS

# Release your app like usual
cd ../..
fastlane submit_playalpha

iOS

On iOS side you need to set your Fabric ID under your Info.plist like: (Only do this if using Fabric, not Firebase as you will not have an API Key)

<key>Fabric</key>
    <dict>
        <key>APIKey</key>
        <string>YOUR_ID_HERE</string>
        <key>Kits</key>
        <array>
            <dict>
                <key>KitInfo</key>
                <dict/>
                <key>KitName</key>
                <string>Crashlytics</string>
            </dict>
        </array>
    </dict>

Turn off automatic collection with a new key to your Info.plist file (GDPR compliency if you want it):

Key: firebase_crashlytics_collection_enabled

Value: false

Don't forget to add your Run Script step (with any version of Xcode) on the build phases tab. If using Xcode 10, you also must add your app's built Info.plist location to the Build Phase's Input Files field:

$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

ios run script

That's it :)

Flutter

All you need to do under your code is to let the plugin handle the Flutter crashes.

Your main method should look like:

void main() async {
  bool isInDebugMode = false;

  FlutterError.onError = (FlutterErrorDetails details) {
    if (isInDebugMode) {
      // In development mode simply print to console.
      FlutterError.dumpErrorToConsole(details);
    } else {
      // In production mode report to the application zone to report to
      // Crashlytics.
      Zone.current.handleUncaughtError(details.exception, details.stack);
    }
  };

  await FlutterCrashlytics().initialize();

  runZoned<Future<Null>>(() async {
    runApp(MyApp());
  }, onError: (error, stackTrace) async {
    // Whenever an error occurs, call the `reportCrash` function. This will send
    // Dart errors to our dev console or Crashlytics depending on the environment.
    await FlutterCrashlytics().reportCrash(error, stackTrace, forceCrash: false);
  });
}

forceCrash allows you to have a real crash instead of the red screen, in that case the exception will be tagged as fatal.

API available

  • Add log to crash reporting with log(String msg, {int priority, String tag})
  • Add manual log to crash reporting with logException(Error/Exception exception, Stacktrace stack)
  • Add user info to crash reporting with setUserInfo(String identifier, String email, String name)
  • Add general info to crash reporting with setInfo(String key, dyncamic value)

Limitation

This plugin uses Crashlytics SDK to log manual dart crashes, all manually logged crashes are tagged as non fatal under Crashlytics, that's a limitation of the SDK.

You can bypass that limitation with the forceCrash parameter, instead of the red screen an actual crash will be appended, the crash will be tagged as fatal.

On iOS fatal crash has their dart stacktrace under the Logs tab of Crashlytics, that's a limitation of iOS that prevents developers to set a custom stacktrace to an exception.

Contribution

We love contributions! Don't hesitate to open issues and make pull request to help improve this plugin.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].