Firebase Crashlytics无效的API KEY AndroidX Gradle 3

时间:2018-09-20 09:13:03

标签: android firebase crashlytics

与许多人一样,我无法使用Firebase Crashlytics添加我的应用程序。 我遵循了official documentation中的所有步骤。

我之前还检查了应用程序并将其添加到Firebase,一切正常。

我的问题如下:

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! 
Contact support@fabric.io for assistance.

我已经正确设置了 google-services.json 文件。根据官方文档,该文件现在可以正常工作了。

编辑-解决方案

就像我在评论中说的那样,我找到了问题。这是因为我使用了Gradle版本。我将项目移至支持AndroidX的位置,并且使用的是最新版本3.3+,但在此版本中,不会在构建阶段解析google-services.json文件。在3.2+版本中已解决。

从Firebase团队开始,只有稳定版本在起作用。

2 个答案:

答案 0 :(得分:2)

您的项目是否构建为支持即时应用程序(即,您具有基本功能模块,可安装模块和即时应用程序模块)?在过去的半天时间里,我一直在处理这个确切的错误,最终为我解决的错误是在我的gradle文件底部为基本功能模块添加了crashlytics { instantAppSupport true }。如果您是为即时应用而构建的,那么可能值得一试。

答案 1 :(得分:0)

您确定已在其中一个文件中添加了Crashlytics API密钥吗?

AndroidManifest.xml:

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

织物特性:

# Fabric properties file: app/fabric.properties
apiSecret=xxxxxxxxxxxxxxxxxxxxxxxxxxx
apiKey=xxxxxxxxxxxxxxxxxxxxxxxxxxx