Problems adding Firebase Crashlytics to Android project - Crashlytics found an invalid API key: null
Asked Answered
P

3

14

I am trying to add Firebase crashlytics to our project but just can not get it to work.

I have followed the instructions adding the necessary lines to our gradle file but no success so far.

The main issue I get is this message: Crashlytics found an invalid API key: null

which seems weird since I thought an API key should not be needed for Firebase.

I use Android studio 3.0.1 with the latest gradle plugin. My project is Ionic based but I have tried to hand modify the gradle file as well with the same results.

Ploughman answered 1/3, 2018 at 15:59 Comment(7)
Mike from Firebase here. Currently Firebase Crashlytics does not support Ionic based apps.Masao
Thanks for the reply Mike, can you share some more details? I am not targeting the html part of the app but the Android part. We use several Firebsase components successfully in our Android app using the cordova-firebase plugin. There is also another repo called cordova-plugin-firebase-crashlytics and I am in contact with that guy on github and he says it works for him.Ploughman
Sorry, I know very little about Cordova so I'm not sure how helpful I can be. If you're seeing that error message, then it means there is some reference to Fabric within the app, when if you're starting fresh with Firebase Crashlytics, you would need to follow the steps here: firebase.google.com/docs/crashlytics/get-startedMasao
Having the exact same problem... very confusing, tried the plugin, got this error, followed firebase instructions and I'm back in the same place... bit of a weird one, no other hints of fabric in any other areas of the appInvocate
Seeing same issue with standard android app.Periodontics
Ended up initializing manually (instead of using plugin) and it worked then (might also be related to fact that I'm also initialising Firebase manually).Periodontics
same issue with multi module app. not sure where to apply the plugin. in base? or in installed?Bali
T
25

I had a similar problem and it turned out that I did not apply google-services plugin in the bottom of build.gradle (in app module)

apply plugin: 'com.google.gms.google-services'

After that it is working

Terrie answered 25/5, 2018 at 5:13 Comment(3)
I was in a hurry and forgot that important line of codeCaleb
Plugin with id 'com.google.gms.google-services' not found.Tbar
@Tbar You need to add classpath 'com.google.gms:google-services:4.3.3' in your project build.gradle to be able to find google-services pluginTerrie
T
4

There is an incompatibility with some other Firebase libraries that add the API key in the manifest for you, for example com.firebaseui:firebase-ui-auth:2.3.0

You can check with the Merged Manifest in Android Studio, to see if that is the case:enter image description here

The issue might be resolve by updating/removing the library if possible, otherwise you can remove the API key by adding a <meta-data> tag with a tools:node="remove" attribute, like this:

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="your.package">

    <application
        ...>

        <meta-data
            android:name="io.fabric.ApiKey"
            tools:node="remove"/>

    </application>

</manifest>

This will tell the manifest merger that you don't want this specific meta-data.

Trask answered 10/3, 2018 at 12:39 Comment(1)
Didn't help. Still the same problem.Schleswig
K
0
    # Fabric properties file: app/fabric.properties    

apiSecret=x8x6x5x54x4xx8xxxx98 #your api hash

apiKey=xx389xxx8xx7x787x8x7x78x78x9x #api key

if you added api key in manifest remove it

Kalisz answered 1/3, 2018 at 16:8 Comment(3)
Is fabric.properties file required for Crashlytics from Firebase? I don't see this in firebase documentation.Trichotomy
where do you find the apikey and apisecret? i do only have one numberBali
I also had to remove fabric.properties, but it is hard to understand that from your answer.Unlisted

© 2022 - 2024 — McMap. All rights reserved.