Firebase Crashlytics Invalid Key Error

大兔子大兔子 提交于 2019-12-10 17:33:17

问题


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

I have followed the steps mentioned in this link.

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

ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: null. 
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.


回答1:


Rolling back to "com.google.gms:google-services:4.0.1" in my project build.gradle file fixed the problem for me.

The Firebase docs say to use version 4.1.0, which if you follow will give the error above.




回答2:


Please note the following things, this should solve your issue:

  1. Check Android Studio version, suggested version is 3.1.4.
  2. Classpath (project-level build.gradle file shouldn't have any alpha or beta versions. That is because Firebase only supports stable version of Android Studio.

That said, the recommended setup of your gradle version is:

classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'



回答3:


Firebase Crashlytics requires the Google services Gradle plugin (com.google.gms:google-services) in your build script to process the google-services.json file at build time. However, Crashlytics does work on devices that do not have Google Play services.

I have added this line at end of build.gradle

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


来源:https://stackoverflow.com/questions/49297189/firebase-crashlytics-invalid-key-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!