Crashlytics class not recognized with Firebase Crashlytics SDK - android

With the Firebase Crashlytics SDK, the documentation explains how you can
force a crash
However, in the line:
Crashlytics.getInstance().crash();
Crashlytics is unrecognized and cannot be imported.
I tried switching to FirebaseCrashlytics.getInstance() but there is no crash() method.
Note: Crashlytics is indeed set up properly - I am able to cause my own crash by looking up a view that does not exist and it is reported correctly.

We have deprecated the force crash method in the new SDK. One example of a way to force a crash is manually throwing an exception
throw new RuntimeException("This is a crash");

Related

(Breaking Again) The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. (Android)

I've been using facebook sdk for over a year now and i had followed the docs accordingly but since yesterday the app started throwing the error and it's also occurring in the previous release build (Which was running fine till yesterday). I checked the other answers which suggest adding the string in the manifest file but that has already been added & on iOS it's working fine.
Fatal Exception: com.facebook.FacebookSdkNotInitializedException
The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
com.facebook.internal.Validate.sdkInitialized (Validate.kt:129)
com.facebook.appevents.AppEventsLoggerImpl.<init> (AppEventsLoggerImpl.kt:642)
com.facebook.appevents.AppEventsLoggerImpl.<init> (AppEventsLoggerImpl.kt:82)
com.facebook.appevents.AppEventsLogger.<init> (AppEventsLogger.kt:118)
com.facebook.appevents.AppEventsLogger.<init>
com.facebook.appevents.AppEventsLogger$Companion.newLogger (AppEventsLogger.kt:369)
com.facebook.appevents.AppEventsLogger.newLogger (Unknown Source:2)
com.facebook.reactnative.androidsdk.FBAppEventsLoggerModule.initialize (FBAppEventsLoggerModule.java:129)
com.facebook.react.bridge.ModuleHolder.doInitialize (ModuleHolder.java:236)
com.facebook.react.bridge.ModuleHolder.markInitializable (ModuleHolder.java:100)
com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized (NativeModuleRegistry.java:129)
com.facebook.react.bridge.CatalystInstanceImpl$2.run (CatalystInstanceImpl.java:452)
Apparently client token was missing, adding that fixed it
Ref: https://github.com/thebergamo/react-native-fbsdk-next/issues/236#issuecomment-1111744717

what does "crashlytics app initializer Disabling" mean?

I use FirebaseCrashlytics 6.0.0 and it doesn't work.
In Android Studio logcat I see the following error and I would like to know what this means:
crashlytics app initializer Disabling

Firebase Crashlytics and NDK Native Crashes

I have been trying to get Crashlytics to capture native/fatal/C++ crashes for our Unity project. I was able to get it to work for iOS without much effort. Also, it works for non-fatal exceptions in Android. I see the exceptions on the Console. However, if I crash the app from C++ code (e.g segmentation violation or raising a signal), I do not have any crash logged in the console.
To have native crashes working, I started by just adding a dependency on the CrashlyticsNDK .aar (com.crashlytics.sdk.android.crashlytics-ndk-2.1.0), but no luck. Searching on the internet, I found that I might need initialize Fabric myself. So I added the meta-data line in the manifest to disable automatic initialization, and added the following code in our Activity.onCreate():
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
I see in the logs that auto-initialization is skipped. Still, no fatal crash being logged in the console.
I decompiled all those .aar files to try to understand what's going on. I found that whenever we disable auto-initialization, io.fabric.sdk.android.Fabric.java goes through a whitelisting logic that removes the CrashlyticsNdk kit from the list! It prints the following message in the logs:
08-01 22:07:14.278: W/Fabric(20797): Fabric will not initialize any kits when Firebase automatic data collection is disabled; to use Third-party kits with automatic data collection disabled, initialize these kits via non-Fabric means.
Then, I tried to hack the Fabric initialization by pretending the data collection is on during initialization only, as follow:
DataCollectionArbiter.getInstance(this).setCrashlyticsDataCollectionEnabled(true);
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
Fabric.getLogger().i("MyCrashlyticsInit", "My crashlytics initialization successful");
DataCollectionArbiter.getInstance(this).setCrashlyticsDataCollectionEnabled(false);
Now, I can see some interesting log lines:
08-01 22:45:39.356: I/FirebaseInitProvider(24353): FirebaseApp initialization successful
08-01 22:45:39.362: I/CrashlyticsInitProvider(24353): CrashlyticsInitProvider skipping initialization
08-01 22:45:39.404: D/libcrashlytics(24353): Initializing libcrashlytics version 2.0.5
08-01 22:45:39.404: D/libcrashlytics(24353): Initializing native crash handling successful.
08-01 22:45:39.419: I/CrashlyticsCore(24353): Initializing Crashlytics Core 2.7.0.33
08-01 22:45:39.427: I/MyCrashlyticsInit(24353): My crashlytics initialization successful
So, when I crash the app and run it again, I get the log line below:
08-01 22:45:39.489: W/CrashlyticsCore(24353): Received null settings, skipping report submission!
I have the impression the crash was handled correctly, but Crashlytics could not upload the crash data because of invalid/null settings.
I would appreciate if someone could help me with this. Getting Crashlytics to work has to be much simpler, and I have the feeling I've done something wrong along the way.
Thanks in advance, and sorry if I was too verbose. Just wanted to show the whole context.

CrashlyticsListener not triggered by crashes in JNI

I'm setting a CrashlyticsListener like instructed here to get a callback on the next app start after crash occurred. crashlyticsDidDetectCrashDuringPreviousExecution() is triggered if the app has crashed in with a Java exception on previous run, but if it has crashed in JNI it's not triggered.
I'm initializing Crashlytics with NDK support
Fabric.with(FiosSdkApplication.getAppContext(), new Crashlytics(), new CrashlyticsNdk());
and I see the crash report being uploaded:
06-08 15:36:03.177 23571-23619/com.organization.test.crashlyticstest I/CrashlyticsCore: Crashlytics report upload complete: 5B1AE89B032E-0001-5B97-8C8248E28ED2
and I see that crash on the dashboard later, but the callback is not being called. Is it supposed to be called after JNI crashes at all? If yes, what am I missing?
The versions of Crashlytics I'm using are the latest I believe:
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3#aar') {
transitive = true
}
implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.0.4#aar') {
transitive = true
}
Mike from Fabric here. At the moment, the CrashlyticsListener doesn't support being called from when an NDK/JNI exception happens.

Android crashes reported in DigitsActivity, DigitsActionBarActivity, FailureActivityDelegateImpl

Crashlytics is reporting crashes that happen in DigitsActivity, DigitsActionBarActivity, FailureActivityDelegateImpl.
Crash is: Fatal Exception: java.lang.IllegalAccessError: This activity can only be started from Digits
I get this crash reported a few times for each on every build we release.
These activities are apparently a part of the Fabric/Twitter SDK to sign in with a phone number. However, I am not using them at all! Anyone have an explanation for what could be happening here?
If you don't use Digit's, you could try to only include the Twitter-Core:
Upgrade your gradle to:
dependencies {
compile('com.twitter.sdk.android:twitter-core:1.5.0#aar') {
transitive = true;
}
}
And your application's onCreate to:
Fabric.with(this, new TwitterCore(authConfig));

Categories

Resources