Firebase Crashlytics Invalid Key Error

I want to integrate Firebase Crashlytics into my Android game developed using Cocos2D-X engine.

I have followed the steps mentioned in this link: https://firebase.google.com/docs/crashlytics/get-started.

I am getting following error when building the project using Android Studio:

ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: 382463773959. 
Check the Crashlytics plugin to make sure that the application has been added successfully!

It looks like that I am missing some API key. How can I find the Crashlytics API key in Firebase? How to mention that key in the Android project?

I would appreciate any suggestions and thought on this topic. Thank you.

I’d suggest going to Firebase support resources.

Thank you for the reply. I will check that link.

We have added crashlytics into our project - it is super easy actually;) From your error it means you added wrong api key to android manifest file.

Have a look on our build.gradle:

import org.apache.tools.ant.taskdefs.condition.Os



buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public'
        }
    }


    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        // The Fabric Gradle plugin uses an open ended version to
        // react quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}



apply plugin: 'com.android.application'
apply plugin: 'io.fabric'




repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }

   
}



android {
    compileSdkVersion 22
    buildToolsVersion "25.0.0"

    defaultConfig {
        applicationId "com.mygame.test"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1"
       multiDexEnabled true

        externalNativeBuild {
            ndkBuild {
                if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
                    // skip the NDK Build step if PROP_NDK_MODE is none
                    targets 'MyGame'
                    arguments 'NDK_TOOLCHAIN_VERSION=4.9'
                    arguments 'APP_PLATFORM=android-15'

                    def module_paths = [project.file("../../cocos2d").absolutePath,
                                        project.file("../../cocos2d/cocos").absolutePath,
                                        project.file("../../cocos2d/external").absolutePath]
                    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
                        // should use '/'
                        module_paths = module_paths.collect {it.replaceAll('\\\\', '/')}
                        arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
                    }
                    else {
                        arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
                    }

                    arguments '-j' + Runtime.runtime.availableProcessors()
                    abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
                }
            }
        }
    }


    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }


    sourceSets.main {
        java.srcDir "src"
        res.srcDir "res"
        manifest.srcFile "AndroidManifest.xml"
        assets.srcDir "../../Resources"
       // jniLibs.srcDirs = ['libs']

    }

    externalNativeBuild {
        ndkBuild {
            if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
                // skip the NDK Build step if PROP_NDK_MODE is none
                path "jni/Android.mk"
            }
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    splits {
        abi {
            enable true
            reset()
            include 'armeabi-v7a'
            universalApk false
        }
    }

    signingConfigs {

        release {
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                storeFile file(RELEASE_STORE_FILE)
                storePassword RELEASE_STORE_PASSWORD
                keyAlias RELEASE_KEY_ALIAS
                keyPassword RELEASE_KEY_PASSWORD
            }
        }
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                signingConfig signingConfigs.release
            }

            externalNativeBuild {
                ndkBuild {
                    arguments 'NDK_DEBUG=0'
                }
            }
        }

        debug {
            externalNativeBuild {
                ndkBuild {
                    arguments 'NDK_DEBUG=1'
                }
            }
        }
    }
}



crashlytics {
    enableNdk true
    manifestPath 'AndroidManifest.xml'

   
}



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':libcocos2dx')
    compile 'com.android.support:multidex:1.0.1'
 






    // Crashlytics Kit
    compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
    // NDK Kit
    compile('com.crashlytics.sdk.android:crashlytics-ndk:2.0.2@aar') {
        transitive = true
    }
}
1 Like

Thank you for the reply. Did you mention any Crashlytics API key in the manifest file?

Yes, u should put your api key to manifest file also to make it work, I think there was second option to put it somewhere else. Bit manifest file setup works for 100%

Where to find the API key in Firebase?

It was somewhere in settings in dashboard, just check in google api key crahlyTics

You are talking about Firebase Crashlytics and not Fabric Crashlytics, right?

Fabric Crashlytics, but they are exactly same - Firebaase Crahslytics is just integration between firebase and Fabric.

Does firebase crashlytics support C++/NDK crashes?

We use Crashlytics in our Cocos2D app (iOs/Android) and it seems to work well on all crashes, whether the crash happens in Java files (Android), Objective C (ios) or C++ files.
-Mark
Edit - You mention the NDK - not sure if it matters - but for this App we used CrystaX NDK for Android because Google’s NDK was missing a bunch of standard calls that PC and iOS had, which caused crashes. All these issues went away when I switched it to use CrystaX NDK.

We also wanted to use crystax ndk, but its not compatible with sdkbox

Hi, were you able to set up Firebase Craslytics finally ?

I try to integrate Firebase Crashlitics in the way which described at their documentation(https://firebase.google.com/docs/crashlytics/get-started) but I always has invalid API key message :

“Crashlytics found an invalid API key: null.
Check the Crashlytics plugin to make sure that the application has been added successfully!
Contact support@fabric.io for assistance.”

I also use sdkboxplay and sdkbox firebase plugins. I suspect that the version of game services or firebase core is not match with what required by crashlitics :

Crashlytics requires Google Services plugin version 3.1.2 or higher.
Crashlytics requires use of firebase-core version 11.4.2 or greater.

I ended up using Fabric Crashytics for Android. You can link the Fabric project with your Firebase project making it possible to view all the crash reports from the Firebase console.

yes, it is possible to link Fabric Crashlytics with Firebase console and this is working OK.

But I would like to use Firebase Crashlytics without Fabric. It looks like currently it is not compatible with sdkbox.

Do you use another error reporting library ?

No. Only Fabric Crashlytics.

I see, Thanks.

Hi all, Fabric is migrating to Firebase, so there will be no Facric Crashlytics by the end of the 2019 (as per their own roadmap…)

Crashlytics found an invalid API key: null

I am still getting this error when trying to integrate Firebase Crashlytics following the steps in the Firebase documentation… has anyone been able to successfully integrate this?

Maybe @slackmoehrle could gives us some details if this can be done and how?

Thanks in advance everyone! :slight_smile:

EDIT: found this on stackoverflow, probably related… https://stackoverflow.com/questions/51497336/firebase-crashlytics-not-working-without-fabric-api-key