我正试图找出如何在我的React原生Android应用程序中使用Fabric中的Crashlytics.我遵循Fabric主页上的步骤,在我的构建中添加了一些行.格雷德尔档案.但构建总是崩溃.
使用Crashlytics进行React原生Android开发与使用Android Studio和Java进行原生Android开发有区别吗?
我正试图找出如何在我的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
祝你好运