Failed to retrieve settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/
Asked Answered
U

13

51

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.

  1. I receive it perfectly fine on one of the product flavors, so I assume all works well. However,
  2. 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

Urticaceous answered 9/3, 2018 at 10:58 Comment(4)
- I had the same issue and the reason was that I wasn't connected to the internet.Rorqual
Hi! Can you run ./gradlew assemble --refresh-dependencies when you change for different flavors? Let me know if that results in the crash uploading. :)Yahwistic
Hi Todd, thank you for your suggestion. It did not seem to help. However, i found out that there is one difference between the flavors. All the ones that do not send a crash to Firebase have an entry in the Firebase console under settings/accountlinking/fabric, however, the one that works fine, does not have an entry there as being linked, even though it shows as linked in Fabric.This makes me believe it is something on the Firebase/Fabric team's side.Urticaceous
There is no accountlinking for me however there is one integration tab but that doesn't contain fabric. ps I have a owner permissionMidlothian
U
48

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.

Urticaceous answered 13/3, 2018 at 9:34 Comment(5)
I have the same problem. An app with two dimensions of flavors. So finally in Firebase I have 6 apps. And now only two of them track data to Firebase Crashlytics. Unfortunately I can't follow your soulition. In Firebase Console > Project Settings > Account Linking > I can't see Fabric option. Also in Fabric all my apps are not connected to Firebase. And moreover when I try to connect them Fabric says that some of the already connected. It makes me crazy...Marji
Confim in Fabric > App > Firebase - that it is unlinked didn't make sense to me but after doing everything else it worked. It sucks that this is the best solution.Migratory
Man that was a long headache you helped me with. well done. FYI, you might update that firebaseconsole->project settings -> doesn't have account linking option anywhere. Luckily Fabric-linked-apps->linked Apps Manage -opened it in firebase to the page that I couldn't otherwise find. But this did the trick. They make this so damn difficult to do something so simple. ;(Jumper
Linking/Unlinking doesn't make sense for my scenario since Fabric account was deleted. Removing io.fabric.ApiKey from Manifest worked for me.Punishable
For me the reason i was getting "Failed to retrieve settings" error was that i had not initaliased the Firebase on Dashboard. I simulated my first crash and it was working fine.Reunite
H
13

This takes me a lot of time than I figured out how to migrate correctly. Actually you have two ways how to do it:

  1. 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.

  2. 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.

Homey answered 18/5, 2018 at 19:28 Comment(2)
Do we need to initialize Crashlytics with Fabric in second way? (Fabric.with(this, Crashlytics()))Coryza
Yes. I use second way in my app like this: Fabric.with(this, Crashlytics.Builder().core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build()). This initialize crashlytics and disable it for debug builds.Homey
B
13

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. first step of setup

Click whatever option suits you, I chose the first because it's a new app. After that the second step shows up.

second step of setup

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.

third step of setup 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:

  1. switch to build variant
  2. perform an assemble[YOUR_BUILD_VARIANT] on the gradle tab.
  3. build > rebuild project
  4. delete old app from device if present.
  5. 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
Bionomics answered 1/10, 2019 at 6:53 Comment(2)
Thank you a thousand times! I can confirm that performing the assemble[Variant] task, rebuilding and unistallin/re-installing the app solves the fu**ing issue!Twannatwattle
My problem was that i needed to open Firebase console and verify for first install of sdkEringo
R
11

If there's network connectivity (like in Airplane mode), you will get this error even if everything is setup correctly.

You will also get:

E/Fabric﹕ Failed to retrieve settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/com.xyz/settings
W/Fabric﹕ Received null settings, skipping initialization!

To prevent Crashlytics from further crashing when logging, I do this:

boolean fabricInitialized = Fabric.isInitialized();
if (fabricInitialized) {
   Crashlytics.log(someString);
}
Ratiocination answered 26/2, 2015 at 18:28 Comment(2)
You will get this same error if you have not activated crashlytics in the firebase console.Caraway
It helped me to clean my project, and try again.Frightfully
M
11

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.

Marji answered 19/3, 2018 at 11:13 Comment(4)
Actually in my experience you don't have to redownload google-service.json cause nothing important changes. Instead in my case the problem was that when I was linking existing Crashlytics account, I did not have SHA-1 key added to my Firebase Project. What I had to do is to add SHA-1 key, unlink Fabric and link it again.Nasal
Maybe you're right and there's no need to redownload the google-service.json. But I have quite long dialogue with Firebase Support and they didn't say anything about adding SHA-1 in Firebase Console, even when I meshioned that this point is missed from documentation.Marji
prefer SHA-256. it works the same way as SHA-1 and it's stronger.Smaltite
This was the issue for me, but I did not have to re-download the google-service.json files.Fortunato
C
9

You probably forgot to add:

<meta-data
            android:name="io.fabric.ApiKey"
            android:value="h4132h4k324hjh4l4324h24hk21h4kj2h4" />

To your Manifest file. At least in my case, that was the reason.

Confab answered 7/5, 2018 at 22:15 Comment(2)
If you don't want to connect to Firebase console, add this line to Android Manifest file if it is missing. (Till 2020 this would be valid :p)Phobia
@Phobia i done the connection (i want to move to firebase), but without that i continue to receive error in log. what i miss ?Extort
D
3

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.

Dulcimer answered 6/10, 2018 at 7:54 Comment(1)
where do i get the api key from?Kopple
C
1

I'm finding out that I had to unregister and re-register my existing apps with Firebase after converting over to FirebaseCrashlytics.

Make sure you get your app to the following point before running it for it's initial FirebaseCrashlytics registration (console waits for initial registration), otherwise it won't register: enter image description here

None of this is obvious!

Crofter answered 5/5, 2020 at 18:42 Comment(1)
Could you elaborate how did you unregister and re-register your app?Karlykarlyn
K
1

Upgrade to the Firebase Crashlytics SDK Android & iOS

You can now set up Crashlytics in your app by using the new official Firebase Crashlytics SDK, which offers improved APIs that are more consistent with other Firebase products and more intuitive to use. This guide describes how to upgrade to the new SDK from the Fabric Crashlytics SDK. It describes the changes that come with the new APIs, the reason for the changes, and how to update your code, if required.


Android

Precondition: Migrate your app to AndroidX

1. Add a Firebase configuration file

  1. Open your Project Settings.
  2. Click Download google-services.json to obtain your Firebase Android config file.
  3. Move your config file into the module (app-level) directory of your app.

2. Switch your dependencies

(project-level)/build.gradle

Deprecated From:

buildscript {
  // ...

   repositories {
       // ...
       // Remove Fabric's Maven repository.
       maven { url 'https://maven.fabric.io/public' }
       // Add Google's Maven repository (if it's not there already).
       google()
   }

    dependencies {
        // ..

        // Add the Google Services Gradle plugin (if it's not there already).
        classpath 'com.google.gms:google-services:4.3.3'
       // Remove the Fabric Gradle plugin.
       classpath 'io.fabric.tools:gradle:1.31.2'
    }
}

To:

buildscript {
  // ...

   repositories {
       // ...

       // Add Google's Maven repository (if it's not there already).
       google()
   }

    dependencies {
        // ..

        // Add the Google Services Gradle plugin (if it's not there already).
        classpath 'com.google.gms:google-services:4.3.3'

        // Add the Firebase Crashlytics Gradle plugin.
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.0'
    }
}

(app-level)/build.gradle

Finally, add the Firebase Crashlytics SDK. In your app-level build.gradle, replace the legacy Fabric Crashlytics SDK with the new Firebase Crashlytics SDK. For an optimal experience with Firebase Crashlytics, we recommend also adding the Firebase SDK for Google Analytics to your app (make sure to add Version 17.2.3 or later in order to get real time crash-free users and breadcrumbs).

Deprecated From:

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'
// Remove the Fabric plugin.
apply plugin: 'io.fabric'
dependencies {
    // Remove the Fabric Crashlytics SDK.
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.1'
}

To:

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'


// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

dependencies {
    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.1'
}

Update your code

  • Crashlytics.log is now an instance method

From Fabric: Crashlytics.log("my message");

To Firebase Crashlytics SDK:

FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
// To log a message to a crash report, use the following syntax:
crashlytics.log("E/TAG: my message");
  • The crash method is removed

From Fabric: Crashlytics.getInstance().crash().

To Firebase Crashlytics SDK:

throw RuntimeException("Test Crash")

Now, FirebaseCrashlytics starts up automatically using a ContentProvider defined in the new Firebase Crashlytics SDK. Remove calls to Fabric.with() if they exist. If you're already using Firebase Crashlytics, your app may already be using automatic startup and may not contain a call to Fabric.with().

GL

Kopple answered 8/5, 2020 at 14:45 Comment(0)
M
1

I came across this issue in the new Firebase SDK upgrade to 17.0.0+ version.

The issue was caused when we use multiple flavors. In case you are using a separate flavor - debug and have it linked to firebase as well, instead of adding the google-services.json file to the app root, we have to add the flavor specific json file to the appropriate folder for the flavor - app -> src -> (flavor folder).

This will ensure that the generated code has the correct client id for the flavor.

This is a silly mistake but there are chances for people to miss it.

Macario answered 14/7, 2020 at 4:15 Comment(0)
S
1

At First you have to enable the Crashlytics in the Crashlytics tab in your project in the console (before or after adding all the dependencies of crashlytics) or follow these steps present in this link:
https://firebase.google.com/docs/crashlytics/get-started?authuser=0&platform=android

Stoltz answered 1/10, 2020 at 2:43 Comment(0)
P
0

After checking internet connection, I solved this issue by activate Crashlytics for my app in the Firebase console (then, relaunch app and all should work fine)

enter image description here

Pumpkin answered 23/7, 2019 at 9:1 Comment(0)
L
0

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.

Luannaluanne answered 18/1, 2020 at 7:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.