Firebase Crashlytics 不支持 NDK?
Firebase Crashlytics does not support NDK?
当您想使用 Crashlytics NDK 时,您需要调用 Fabric.with(this, new Crashlytics(),new CrashlyticsNdk());
但是 Firebase Crashlytics 会调用
Fabric.with(context, new Kit[]{new Crashlytics()});
启动时。
因此您无法使用 Crashlytics NDK。
如何避免这个问题?
public class CrashlyticsInitProvider extends ContentProvider {
private static final String TAG = "CrashlyticsInitProvider";
public CrashlyticsInitProvider() {
}
public boolean onCreate() {
Context context = this.getContext();
FirebaseInfo firebaseInfo = new FirebaseInfo();
CrashlyticsInitProvider.EnabledCheckStrategy enabledCheckStrategy = new ManifestEnabledCheckStrategy();
if (this.shouldInitializeFabric(context, firebaseInfo, enabledCheckStrategy)) {
try {
Fabric.with(context, new Kit[]{new Crashlytics()}); // !here
Fabric.getLogger().i("CrashlyticsInitProvider", "CrashlyticsInitProvider initialization successful");
} catch (IllegalStateException var5) {
Fabric.getLogger().i("CrashlyticsInitProvider", "CrashlyticsInitProvider initialization unsuccessful");
return false;
}
}
return true;
}
将此添加到您的 AndroidManifest.xml
:
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
然后在您的 Application
子类中手动初始化 Crashlytics:
Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new CrashlyticsNdk())
.build();
Fabric.with(fabric);
见https://firebase.google.com/docs/crashlytics/force-a-crash#enable_debug_mode
Android Firebase Crashlytics SDK 已支持 NDK 崩溃报告。使用 Firebase Crashlytics SDK 设置 Crashlytics 后,您可以将以下内容添加到 app/build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
// ...
// Add the Crashlytics NDK dependency.
implementation 'com.google.firebase:firebase-crashlytics-ndk:17.0.0-beta01'
}
// …
android {
// ...
buildTypes {
release {
// Add this extension
firebaseCrashlytics {
// Enable processing and uploading of native symbols to Crashlytics
// servers. By default, this is disabled to improve build speeds.
// This flag must be enabled to see properly-symbolicated native
// stack traces in the Crashlytics dashboard.
nativeSymbolUploadEnabled true
}
}
}
}
在此处查看更多内容:https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk
当您想使用 Crashlytics NDK 时,您需要调用 Fabric.with(this, new Crashlytics(),new CrashlyticsNdk());
但是 Firebase Crashlytics 会调用
Fabric.with(context, new Kit[]{new Crashlytics()});
启动时。
因此您无法使用 Crashlytics NDK。
如何避免这个问题?
public class CrashlyticsInitProvider extends ContentProvider {
private static final String TAG = "CrashlyticsInitProvider";
public CrashlyticsInitProvider() {
}
public boolean onCreate() {
Context context = this.getContext();
FirebaseInfo firebaseInfo = new FirebaseInfo();
CrashlyticsInitProvider.EnabledCheckStrategy enabledCheckStrategy = new ManifestEnabledCheckStrategy();
if (this.shouldInitializeFabric(context, firebaseInfo, enabledCheckStrategy)) {
try {
Fabric.with(context, new Kit[]{new Crashlytics()}); // !here
Fabric.getLogger().i("CrashlyticsInitProvider", "CrashlyticsInitProvider initialization successful");
} catch (IllegalStateException var5) {
Fabric.getLogger().i("CrashlyticsInitProvider", "CrashlyticsInitProvider initialization unsuccessful");
return false;
}
}
return true;
}
将此添加到您的 AndroidManifest.xml
:
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
然后在您的 Application
子类中手动初始化 Crashlytics:
Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new CrashlyticsNdk())
.build();
Fabric.with(fabric);
见https://firebase.google.com/docs/crashlytics/force-a-crash#enable_debug_mode
Android Firebase Crashlytics SDK 已支持 NDK 崩溃报告。使用 Firebase Crashlytics SDK 设置 Crashlytics 后,您可以将以下内容添加到 app/build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
// ...
// Add the Crashlytics NDK dependency.
implementation 'com.google.firebase:firebase-crashlytics-ndk:17.0.0-beta01'
}
// …
android {
// ...
buildTypes {
release {
// Add this extension
firebaseCrashlytics {
// Enable processing and uploading of native symbols to Crashlytics
// servers. By default, this is disabled to improve build speeds.
// This flag must be enabled to see properly-symbolicated native
// stack traces in the Crashlytics dashboard.
nativeSymbolUploadEnabled true
}
}
}
}
在此处查看更多内容:https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk