vjtechno
vjtechno

Reputation: 484

In React-Native the Firebase-Crashlytics log is not showing on Firebase Crashlytics dashboard

I am using react-native-firebase in my app. I have used Crashlytics and tried to show the Crashlytics log in the firebase dashboard. so I have used crashlytics().log for logs. But the logs are not shown on the firebase dashboard.

Code:

import crashlytics from "@react-native-firebase/crashlytics";

class CrashlyticFile {
  constructor() {}

  init = () => {
    crashlytics().log("Crash init Called!!");
let result = "";
    let characters = Strings.characterString
    let charactersLength = characters.length;
    for (let i = 0; i < 10; i++) {
      result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }
       crashlytics().log("Crash App id",result);
  };
   
  }; 
}
export default new CrashlyticFile();

App.js

import React, { useEffect, StrictMode, useState, useMemo } from "react";
import Crashlytic from "./services/Crashlyatic";

  useEffect(() => {
    crashlytics().log("crashlytics in app js");
    Crashlytic.init();
    return () => {
      
    };
  }, []);

  return (
    <View>
   <Text>Firebase Crashlytics</Text>
</View>
  );
};

export default App;

Upvotes: 3

Views: 2065

Answers (2)

Manish Singh Chouhan
Manish Singh Chouhan

Reputation: 381

Make sure that you are using the Signed APK not the debug one. In case of signed APK only. It will give you the logs.

enter image description here

Some times it only show this Add SDK after setting all the things at that time also you have to use Signed APK and crash your APK once than only. You will able to see the Dashboard of Logs.

Upvotes: 1

Jignesh Mayani
Jignesh Mayani

Reputation: 7193

The log message using the crashlytics().log() will only log the message to the crashlytics dashboard if the crash occurred.

after the crashlytics().log() if there is something that makes the app to be crash then and only then we can receive the crash in the firebase console and there we can see the logs in the logs tab that we have added to our code.

The main objective of the log method is to attach the user's custom log to the crash.

We can have a try by manually crashing the app after the crashlyics().log() method call to see the log messages.

Upvotes: 1

Related Questions