我正试图找出如何在我的React原生Android应用程序中使用Fabric中的Crashlytics.我遵循Fabric主页上的步骤,在我的构建中添加了一些行.格雷德尔档案.但构建总是崩溃.

使用Crashlytics进行React原生Android开发与使用Android Studio和Java进行原生Android开发有区别吗?

推荐答案

我让它在某种程度上发挥了作用,但它可能不是完美的解决方案...

1: Add fabric/crashlytics into your app/build.gradle - File

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

  dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    // The Fabric Gradle plugin uses an open ended version to react
    // quickly to Android tooling updates
    classpath 'io.fabric.tools:gradle:1.+'
  }
}

// Add this directly under: apply plugin: "com.android.application"
apply plugin: 'io.fabric'

// and this directly under: apply from: "react.gradle"
repositories {
  jcenter()
  maven { url 'https://maven.fabric.io/public' }
}

// Last but not least add Crashlytics Kit into dependencies
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    transitive = true
}

2: The most important, because it is nowhere mentioned (or i didn´t find it anywhere), import Crashlytics and Fabric into MainActivity:

import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;

3: In your onCreate - method add:

// Fabrics
Fabric.with(this, new Crashlytics());

当你这么做的时候,你至少会收到由本机代码(Java代码)引起的崩溃报告.不会通知通过JS-Syntax或类似方式导致的崩溃.在那里你会得到已知的红盒:P

祝你好运

React-native相关问答推荐

根据搜索字符串中的每个字母过滤数组

找不到变量:firebase/react native(expo)上的 IDBIndex

调用 ES6 方法时绑定上下文.如何从称为回调的方法中访问对象?

在 React Native 中从 Modal 打开 Modal

如何获取 React Native 应用程序的崩溃日志(log)?

'React native run android' 在模拟器中启动应用程序后立即停止

如何在react-native中淡化视图的边缘?

RNFS.exists() 总是返回 TRUE

为了回调 URL 的目的,在 Expo 中运行的 React Native 元素的 info.plist 在哪里?

使用 react-native 单击时如何更改图像和文本 colored颜色 ?

使用直接在 Windows 中运行的模拟器在 WSL 中运行 React Native

如何在 React Native cli 中获取 SHA-1 密钥?

Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

React Native - 用分机拨打电话号码

React native - 创建单例模式的最佳方式

react native如何访问文件系统?

Native Script 与 react native 和 ionic 框架的区别

React native - 以编程方式判断是否启用了远程 JS 调试

react-native:多色文本视图

react-native构建错误:package android.support.annotation does not exist