gpt4 book ai didi

android - FirebaseInitProvider : FirebaseApp initialization unsuccessful

转载 作者:IT王子 更新时间:2023-10-28 23:48:46 28 4
gpt4 key购买 nike

我们关注了Add Firebase to your Android Project但我们在 Firebase 控制台中看不到应用接收数据。
当我们启动应用程序时,日志显示:

FirebaseInitProvider: FirebaseApp initialization unsuccessful

这是什么意思?我们做错了什么?
我在文档中找不到此错误,在 StackOverflow 中也找不到。

最佳答案

What does this mean? What are we doing wrong?

假设身份验证没有成功。

a) project 级别的 buildscript repositoriesdependencies build.gradle:

buildscript {
repositories {
google()
jcenter()
}
dependencies {

// Android Gradle Plugin
classpath "com.android.tools.build:gradle:3.3.2"

// Google Services Plugin
classpath "com.google.gms:google-services:4.2.0"
}
}

b) module 级别 app/build.gradledependencies(Android Intel x86 镜像可能仍具有以前版本的安装的 Google Play 服务,例如 10.2.0 在当前的 x86 模拟器上运行,而例如 11.8.0 在我的物理上运行 ARM设备)。引用 play-servicesfirebase-core 将包含它们的 all 模块,除非将它们排除在外。 更新:现在必须单独引用所有库。引用 com.google.android.gms:play-servicescom.google.firebase:firebase-core 不再起作用,因为 15.0.0.

android {
...
buildTypes {
debug {
// suffixing the package name for debug builds,
// in order to partially mute the crash-reporting
// is an *optional* configuration (see below):
applicationIdSuffix ".debug"
}
}
}

dependencies {

// Google Play Services
// https://developers.google.com/android/guides/releases
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.android.gms:play-services-auth:16.0.0"
implementation "com.google.android.gms:play-services-identity:15.0.1"

// Google Firebase
// https://firebase.google.com/support/release-notes/android
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-auth:16.0.3"
implementation "com.google.firebase:firebase-config:16.0.0"
implementation "com.google.firebase:firebase-storage:16.0.1"
implementation "com.google.firebase:firebase-database:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.3.0"
implementation "com.google.firebase:firebase-appindexing:16.0.1"
implementation "com.google.firebase:firebase-functions:16.1.0"
implementation "com.google.firebase:firebase-invites:16.0.1"
// implementation "com.google.firebase:firebase-crash:16.0.1"
implementation "com.google.firebase:firebase-ads:15.0.1"
implementation "com.google.firebase:firebase-firestore:17.0.4"
implementation "com.google.firebase:firebase-perf:16.0.0"

// the inapp messaging may cause dependency conflicts:
// implementation "com.google.firebase:firebase-inappmessaging:17.0.0"
// implementation "com.google.firebase:firebase-inappmessaging-display:17.0.0"
}

c) mobile/build.gradle 的底线应该是:

// apply the Google Services Plugin
apply plugin: "com.google.gms.google-services"

d) 确保在 app/google-services.json 中提供(下载的)凭据;在 Firebase 控制台上,必须添加 both SHA1(或 SHA256)散列,调试 发布 key ,以使两个版本都能正确进行身份验证;一旦全部匹配,它应该报告:

I/FirebaseInitProvider: FirebaseApp initialization successful

这一切都有很好的记录,请参阅 Setup Google Play Services , Firebase QuickstartCrash Reporting ;虽然我发现 Firebase 博客上的这篇文章非常有用:Organizing your Firebase-enabled Android app builds ,因为它解释了如何部分静音崩溃报告。 release notes始终宣布更新和更改。

关于android - FirebaseInitProvider : FirebaseApp initialization unsuccessful,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37321728/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com