简体   繁体   English

在 React-Native 中,Firebase-Crashlytics 日志未显示在 Firebase Crashlytics 仪表板上

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

I am using react-native-firebase in my app.我在我的应用程序中使用react-native-firebase I have used Crashlytics and tried to show the Crashlytics log in the firebase dashboard.我使用过Crashlytics并尝试在 firebase 仪表板中显示Crashlytics日志。 so I have used crashlytics().log for logs.所以我使用crashlytics().log记录日志。 But the logs are not shown on the firebase dashboard.但日志未显示在 firebase 仪表板上。

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应用程序.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;

The log message using the crashlytics().log() will only log the message to the crashlytics dashboard if the crash occurred.使用 crashlytics().log() 的日志消息只会在发生崩溃时将消息记录到 crashlytics 仪表板。

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.在 crashlytics().log() 之后,如果有什么东西导致应用程序崩溃,那么只有这样我们才能在 firebase 控制台中接收到崩溃,在那里我们可以在我们添加到我们的日志选项卡中看到日志代码。

The main objective of the log method is to attach the user's custom log to the crash. log 方法的主要目的是将用户的自定义日志附加到崩溃中。

We can have a try by manually crashing the app after the crashlyics().log() method call to see the log messages.我们可以尝试在 crashlyics().log() 方法调用后手动使应用程序崩溃以查看日志消息。

Make sure that you are using the Signed APK not the debug one.确保您使用的是签名 APK 而不是调试版。 In case of signed APK only.仅在签名 APK 的情况下。 It will give you the logs.它会给你日志。

在此处输入图像描述

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.有时它只显示这个Add SDK在设置所有的东西之后你还必须使用签名的 APK 并且不止一次崩溃你的 APK。 You will able to see the Dashboard of Logs.您将能够看到日志仪表板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM