问题描述
我面临一个非常奇怪的问题,当我尝试打开应用程序时遇到此崩溃:
{{1}}
没有解决的线索。我的应用程序文件夹中确实有google.services.json
解决方法
你忽略了两件事 (1) 在您的项目级 build.gradle 文件中,添加 Crashlytics Gradle 插件作为 buildscript 依赖项。
buildscript {
repositories {
// Check that you have Google's Maven repository (if not,add it).
google()
}
dependencies {
// ...
// Check that you have the Google services Gradle plugin v4.3.2 or later
// (if not,add it).
classpath 'com.google.gms:google-services:4.3.8'
// TODO:Add the Crashlytics Gradle plugin
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}
allprojects {
repositories {
// Check that you have Google's Maven repository (if not,add it).
google()
}
}
(2) 在您的应用级 build.gradle 文件中,应用 Crashlytics Gradle 插件
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' // Google services Gradle plugin
// TODO:Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'
希望对你有帮助。