Firebase Crashlytics for Android does not work - android

I'm trying to install Firebase Crashlytics on my Android application. I've never used it before.
Apparently the docs are not complete because doing everything step by step does not help to enable Crashlytics - https://firebase.google.com/docs/crashlytics/get-started?authuser=0
I tried force initializing it with Fabric.with(this, new Crashlytics()); added to onCreate() of my Application class. Didn't help.
Logs:
06-06 19:53:01.750 2946-2946/my.package I/CrashlyticsCore: Initializing Crashlytics 2.6.3.25
06-06 19:53:02.572 2946-3015/my.package E/Fabric: Settings request failed.
06-06 19:53:02.590 2946-3010/my.package E/Answers: Failed to retrieve settings
Any ideas what's wrong? Maybe it's internal Firebase issue and it broke globally? Something is wrong here.

Related

Firebase Crashlytics : Settings request failed - After migrate from fabric

After I migrate to crashlytics from fabric, crash reports does not shown on Firebase console anymore.
I followed upgrade document for migration.
I tried force crash to test and i logged with adb logcat -s FirebaseCrashlytics, I noticed an error with reading settings.
FirebaseCrashlytics: Settings request failed.
09-29 16:09:56.619 683 721 D FirebaseCrashlytics: Requesting settings from https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/1:657730209335:android:0f0486036fa5647e/settings
09-29 16:09:56.619 683 721 D FirebaseCrashlytics: Settings query params were: {instance=23c94567f3a0450c2c4276ef9c4f083d3e073ab9, build_version=714012888, display_version=7.14.0.128, source=1}
09-29 16:09:56.641 683 721 E FirebaseCrashlytics: Settings request failed.
Here is my settings.
{"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"5e00a1546bfe67fb08000062","bundle_id":"com.univera.android"}}
firebase_crashlytics_enabled" status false in settings.
Crashlytics enabled on console.
I m using version 17.2.1 implementation 'com.google.firebase:firebase-crashlytics:17.2.1' and i enabled CrashlyticsCollection FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
Why firebase_crashlytics_enabled" status false in my settings and whats wrong about settings request.
Does anyone see the raports on firebase console after migrate from fabric ?
Your app must execute the following line to initialize Firebase at start-up:
FirebaseApp.initializeApp(getContext());
Also, you may want to set a user id so that crashes are tagged with the user id in the Firebase console:
FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.setUserId("yourUserTag");
I faced the same issue, having this error :
E/FirebaseCrashlytics: Settings request failed.
java.net.SocketException: socket failed: EPERM (Operation not permitted)
This was a device specific issue. I have this error on a Xiaomi Mi A3, but when I launched the app on an emulator I had no error and the crashes appeared well in crashlytics.
There is no need to initialize Firebase in your code as matdev said.
Try running your app on a different device or emulator and see if the problem persists.
I fixed this issue by adding firebase-settings.crashlytics.com to allow domain list in network-security-config
This may help
https://stackoverflow.com/a/70858796/8499308

How to test new Firebase Crashlytics SDK?

I've implemented the new Firebase Crashlytics SDK replacing the old Fabric SDK. So, I need to test if this new changes reports something to Firebase Crashlytics Console, there is a web inside developer guide test-implementation-new-sdk but it is giving me a 404 error. So, I don't know how to test a crash to see if the sdk is reporting to the platform correctly.
Any advice?
I've tried with:
throw new RuntimeException("FIREBASE CRASHLYTICS TEST::" + DateFormat.getDateTimeInstance().format(new Date()));
and it worked for me.

Crashlytics class not recognized with Firebase Crashlytics SDK

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");

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.

Cannot find GOOGLE appId for project : <projectid>

I'm implementing google authentication on firebase using the firebaseui lib.
Firebase is working properly, i can access the data in my database, and email/password auth is also working, although when i try to login using google i always get the same error :
W/AuthMethodPicker: Firebase sign in with credential unsuccessful
com.google.firebase.FirebaseException: An internal error has occured. [ Cannot find GOOGLE appId for project: 12345678. ]
at com.google.android.gms.internal.zzafg.zzes(Unknown Source)
at com.google.android.gms.internal.zzafd$zzg.zza(Unknown Source)
at com.google.android.gms.internal.zzafo.zzet(Unknown Source)
at com.google.android.gms.internal.zzafo$zza.onFailure(Unknown Source)
at com.google.android.gms.internal.zzafj$zza.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:453)
i know that this value is extracted from the json file and added as a resource property during build by com.google.gms.google-services plugin, so i checked and the property was in fact added but for some reason it seems that firebase is not able to read it at runtime..
Any idea about what i can be doing wrong?
thanks!
Before you generated your app's google-services.json, did you enable Google Sign In for your project?
https://developers.google.com/identity/sign-in/android/start-integrating
Make sure you have a Firebase project
In that project make sure you have enabled GOOGLE AUTHENTICATION
Now Download a fresh copy of the google-services.json and replace it with the old one inside your app folder
yes i enabled google auth before generating the json.
Another detail is descovered in the meantime if that google auth does work without firebase-ui.
What i did was to try their example of google auth (adding to my app source) and it worked without issues.
Adding firebase-ui seems to remove the need for some extra logic so i wanted to use it, but it seems i'm either missing something or there is a bug on firebase-ui .
Leaving this here for anyone that might encounter this issue now.
Had a similar problem to above only difference is i had it on iOS. Would try to launch and sign in through google and would get the same internal error.
What worked for me was enabling the identity kit on google API and then checking "Google" and the other providers I used. You can find this on the google cloud console -> API Manager -> Dashboard.
App restart, clean build and then everything worked.

Categories

Resources