react-native-fabric: Cannot read property 'crash' of undefined - on android

I got this for android using; react-native-cli: 1.3.0 react-native: 0.38.0 and "react-native-fabric": "^0.3.2" in package.json

image

Followed this resource, but still the same error I imported the class in both ways as; import Fabric, {Crashlytics} from 'react-native-fabric'; and secondly as var Fabric = require('react-native-fabric'); var {Crashlytics} = Fabric;

In both cases, it gave the same error. 😦

trace from VS Code debugger:

Cannot read property 'crash' of undefined
Cannot read property 'crash' of undefined
Module AppRegistry is not a registered callable module (calling runApplication)
Unable to symbolicate stack trace: The stack is null
Unable to symbolicate stack trace: The stack is null

Any one came up with the solution to this, buddies !

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

@vdlindenmark This means you don’t have the native module registered correctly for Android.

That’s right @corymsmith

I figured out that while using the react-native-navigation library, the iOS version works perfect, but for android, we change MainApplication.java class to extend to NavigationApplication which creates a problem for react-native-fabric

This is how is got it working with react-native-navigation

public class MainApplication extends NavigationApplication {

    @Override
    public boolean isDebug() {
        // Make sure you are using BuildConfig from your own application
        return BuildConfig.DEBUG;
    }

    @Override
    public List<ReactPackage> createAdditionalReactPackages() {
        // Add the packages you require here.
        // No need to add RnnPackage and MainReactPackage
        return Arrays.<ReactPackage>asList(
                new FabricPackage(),
                new VectorIconsPackage(),
                new LinearGradientPackage(),
                new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)
        );
    }

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

        @Override
        protected String getJSBundleFile() {
            return CodePush.getJSBundleFile();
        }

        @Override
        protected boolean getUseDeveloperSupport() {
            return BuildConfig.DEBUG;
        }

        @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                    new MainReactPackage()
            );
        }
    };

    @Override
    public ReactNativeHost getReactNativeHost() {
        return mReactNativeHost;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
        SoLoader.init(this, /* native exopackage */ false);
    }
}

Hope this helps!

I think i have the same error. The app crashed on Android and won’t load. On iOS everything works fine.

01-13 17:18:01.920 5610 5641 E ReactNativeJS: undefined is not an object (evaluating 's.crash')`
01-13 17:18:01.932 5610 5641 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
01-13 17:18:02.043 5610 5641 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)