I am trying out the new Firebase/Crashlytics setup and seem to run into a weird issue.
- I have one Android code base with multiple product flavors and each flavor is a separate individual app.
- all of these apps are registered in Fabric (from the past)
- all of these apps are added in Firebase
- All linking between the two seems ok (from Fabric side as well as from Firebase side, it says that it is all linked up)
- I removed the Fabric API key from the manifest file and added the appropriate plugins/dependencies etc. to both gradle files
I try to send a test crash report as per Firebase instructions.
- I receive it perfectly fine on one of the product flavors, so I assume all works well.
However,
- the rest of the product flavors do not send the crash report and I get this error in log:
E/Fabric: Failed to retrieve settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/package name/settings
Ok, I think I solved the problem, but the solution does not seem to be the way it should work (at least I do not think).
- Go to Firebase Console > Project Settings > Account Linking > Fabric > Select the app and Unlink it
- Confim in Fabric > App > Firebase - that it is unlinked
- Go to Firebase > Project > Crashlytics (select the app you want) and you should now get a dialog to link your app again
- Choose to link as a New Crashlytics (not existing one) and follow the directions
- After that all should work fine
So basically, from Fabric>Firebase screen - there is no link visible and from Firebase>Account Linking>Fabric screen - there is also no linking visible. So no linking, but your crashes will be visible in Firebase.
This takes me a lot of time than I figured out how to migrate correctly. Actually you have two ways how to do it:
Perform clean migration without keeping crash history from Fabric Crashlytics
This way is described in Firebase Crashlytics developer guide. You have to here remove com.crashlytics.ApiKey
meta-data
from app manifest file.
With this way you must not link Fabric with Firebase otherwise crashes will not shown in Firebase nor Fabric console.
Link Fabric with Firebase and keep the crash history
This way is probably nowhere documented. Crucial is here to keep com.crashlytics.ApiKey
meta-data
in your manifest. Then you need to link Fabric Crashlytics with Firebase. You can also enable forwarding Events (formerly Answers) to Firebase Analytics. Both actions are presented in Fabric console, look for Firebase in a side menu.
All new crash reports show up in both Fabric console and Firebase console. Also this linking arrange a copying all Fabric crash report history to Firebase.
I think firebase-core
artifact is not necessary here, but I added it. I'm also using Fabric Events, so with firebase-core
additional app usage events was appeared in Firebase Analytics.
Go to the settings of the project and add SHA-1 key for your android app.
After that redownload google-service.json to your sources.
This causes disappearing of this error
E/Fabric: Failed to retrieve settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/package name/settings
And after quite a huge delay you'll see crashes in Firebase Console.
By the way this doesn't help me with apps that were registered under one Google account, and after that moved to another account. Wiating for a response of Firebase team about this issue.
I had the same issue and it took me a lot of time to figure out.
I solved my problem by going to FireBase Console > [my project] > Crashlytics
. In the dropdown you need to select your app. After that a wizard with three steps will show up.
Click whatever option suits you, I chose the first because it's a new app. After that the second step shows up.
Now here comes the important part. Make sure you click the link to go to the documentation! A new browser tab will open up. If you already finished the project setup like me, you can close it. After that you will automatically go to the 3rd option. Most of the time I never clicked the link because I had already completed the installation. And once I did I never noticed that the 3rd option was available because I'm at the other tab. As a result I never got to see the 3rd option.
At this point you should open your app and it will automatically connect to Firebase without any problem.
Edit: After I tried to add some other build variants I noticed that I was still getting some errors while retrieving the settings. It took me a lot of time to figure out how to solve it. The best thing I could come up with is:
- switch to build variant
- perform an assemble[YOUR_BUILD_VARIANT] on the gradle tab.
- build > rebuild project
- delete old app from device if present.
- install app and open it.
Sometimes this also didn't work and I tried the same steps again one or two times and suddenly it started working...
It also helped me to enable additional debug logging for fabric and crashlytics.
adb shell setprop log.tag.Fabric DEBUG
adb shell setprop log.tag.CrashlyticsCore DEBUG
In my case, the location of meta-data:io.fabric.ApiKey was wrong.
- app/src/main/AndroidManifest.xml
before
<application
...>
<activity
...>
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxxxxx" />
</activity>
</application>
after
<application
...>
<activity
...>
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxxxxx" />
</application>
I hope this will be of some help.
I posting this answer for those who want it to get it working without unlinking their app from Firebase Crashlytics
.
To Achieve this they have to do following,
Add fabric API key back in AndroidManifest
as metadata
.
<meta-data
android:name="io.fabric.ApiKey"
android:value="fabric_api_key"
/>
Initialize Fabric
.
Fabric.with(this, new Crashlytics());
After doing these two steps Crashlytics
starts working again without unlinking your app.