1.1.10 • Public • Published

Fabric Plugin for Cordova

This is a Cordova plugin for's Crashlytics and Answers services.

It requires Cordova 3.x or newer (tested on 5.4.0) and has APIs for iOS and Android.

The iOS version uses Fabric SDK 1.6.12 and Crashlytics SDK 3.8.5 framework bundles which are located in lib/ios.

The Android version uses Gradle to get the Fabric SDK ( and the Crashlytics SDK ( from Maven repositories when the plugin is added.


  1. Make sure that you have Node and Cordova CLI or PhoneGap's CLI installed on your machine.
  2. Setup your account and get your API Key and Build Secret from your organization page.
  3. Add a plugin to your project using Cordova CLI, specifying the keys with the --variable argument:
# Install from npm registry: 
cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx
# Or to install directly from github: 
# (replace x.x.x with the tag of the version your want, or omit for HEAD) 
cordova plugin add  --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx

Note: If you have never registered an app with your organization, the organization page may redirect you to a wizard preventing you from obtaining your keys. You may be able to obtain your keys from this page. Scroll down to the "Run Script Build Phase" block. The first, shorter string is the API key and the second, longer string is the build secret. If that doesn't work you can follow the wizard and integrate the kit into a dummy "Hello World" project which should then unlock the organization page.


The plugin is available via global variable named fabric. It exposes APIs for both Crashlytics and Answers.

A TypeScript definition file for the JavaScript interface is available in the typings directory.

API Documentation

See typings/cordova-fabric-plugin.d.ts for documentation of the JavaScript APIs including call signatures and parameter types.


Below are a few examples; see the API documentation for a complete list.

Simulate a Native Crash

window.cordovaFabricIoPlugin.Crashlytics.addLog("about to send a crash for testing!");

Send a Non Fatal Crash / Recording Errors

//Android and iOS
window.cordovaFabricIoPlugin.Crashlytics.addLog("about to send a non fatal crash for testing!");
window.cordovaFabricIoPlugin.Crashlytics.sendNonFatalCrash("Error message");
//iOS only. Send message and error code
window.cordovaFabricIoPlugin.Crashlytics.addLog("about to send a non fatal crash for testing!");
window.cordovaFabricIoPlugin.Crashlytics.recordError("Error message", -1);
//Android only. Send stack trace with non fatal crash (requires
window.cordovaFabricIoPlugin.Crashlytics.sendNonFatalCrash("Error message", StackTrace.getSync());

Issue Grouping

Crashes are grouped via stack trace analysis. Logged errors are grouped, instead, by the error domain and code. Remember that this means error issues can span many different call sites.

Set Information for Crash Reports

window.cordovaFabricIoPlugin.Crashlytics.setUserName("Some Guy");
window.cordovaFabricIoPlugin.Crashlytics.setStringValueForKey("bar", "foo");

Send a Sign Up Event

window.cordovaFabricIoPlugin.Answers.sendSignUp("Facebook", true);

Send a Sign Up Event (with custom attributes)

var attributes = {
    foo: "data",
    bar: true,
window.cordovaFabricIoPlugin.Answers.sendSignUp("Facebook", true, attributes);

Send a Add To Cart Event

window.cordovaFabricIoPlugin.Answers.sendAddToCart(29.95, "USD", "Foo Bar Shirt", "apparel", "123");


Automatic Configuration of Fabric SDKs

A normal installation for the Fabric SDKs involves downloading the Fabric tool and pointing it at your native code project. This tool takes care of adding references and modifying your build scripts and/or project files.

This plugin instead performs these steps via two build hooks located in the hooks directory: after_plugin_install and before_plugin_uninstall.

This allows you to avoid using the Fabric tool as well as omit your platforms directory from source control.

Automatic Debug Symbol Upload on Build

The Fabric SDK comes with a command line tool that takes care of uploading debug symbols after a build so that they can be used when viewing crash reports.

For iOS, our build hook adds a build script phase block to execute Fabric's uploader command line tool.

For Android, our build hook modifies the build.gradle file to delegate to Fabric's uploader Gradle task.

Updating Fabric and Crashlytics

Fabric and Crashlytics can be udpated via scripts/ This script creates a temporary directory, obtains packages from their cocoapods download locations, and overwrites the frameworks in lib/ios.

To run the package update script:

npm run add-packages

The desired package versions are pulled from package.json:

    "fabric": "1.7.2",
    "crashlytics": "3.9.3"


If you wish to contribute please see


Package Sidebar


npm i cordova-fabric-io-plugin

Weekly Downloads






Last publish


  • vknabel