Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 724
user1816142 Avatar asked Mar 01 '18 15:03

user1816142


2 Answers

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

like image 177
Rafols Avatar answered Sep 18 '22 22:09

Rafols


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.

like image 22
nicopico Avatar answered Sep 19 '22 22:09

nicopico