FirebaseInitProvider:FirebaseApp初始化失败 [英] FirebaseInitProvider: FirebaseApp initialization unsuccessful

查看:1050
本文介绍了FirebaseInitProvider:FirebaseApp初始化失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经按照将Firebase添加到您的Android项目中,但我们无法看到应用程序正在接收数据Firebase控制台。

当我们启动应用程序时,日志会显示:

  FirebaseInitProvider:FirebaseApp初始化不成功

这是什么意思?我们在做什么错了?

我在文档中找不到这个错误,在这里也没有在StackOverflow中找到这个错误。

解决方案


这是什么意思?我们做错了什么?


假设认证没有成功。

buildscript 存储库依赖关系对于项目级别 build.gradle

  buildscript {
repositories {
jcenter()
}
依赖关系{
$ b $ // Android构建工具Gradle插件
classpathcom .android.tools.build:gradle:2.3.3

// Google服务Gradle插件
classpathcom.google.gms:google-services:3.1.0





code $ c依赖关系级别 mobile / build.gradle (Android的Intel x86图像可能仍然安装了以前版本的Google Play服务,例如 10.2.0 在当前 x86 模拟器上运行,而 11.2.2 在我的物理 ARM 设备上运行)。引用 play-services firebase-core 会编译所有的依赖关系,

$ $ $ $ $ $ $


$ b $ {
//为调试版本添加后缀名,
//为了部分地关闭崩溃报告
//是一个* optional *配置(见下文):
applicationIdSuffix。调试

}
}

依赖关系{
...
// Google Play服务库(特别是 )
compile(com.google.android.gms:play-services:11.2.2){}

// Google Firebase Library
compile( com.google.firebase:firebase-core:11.2.2){}
}



<
$ b

 <$ c>   $ c> //应用Google服务插件
apply plugin: com.google.gms.google-services



确保拥有(下载的)凭据可在 app / google-services.json ;在Firebase控制台上,必须添加debug 发行版密钥存储区的SHA1(或SHA256)散列,以便两者都能正确进行身份验证;一旦所有匹配,应该报告:

pre $ I $ FirebaseInitProvider FirebaseApp初始化成功
$ / code>

全部内容齐全,请参阅设置Google Play服务 Firebase快速入门或< a href =https://firebase.google.com/docs/crash/android =nofollow noreferrer>崩溃报告;而我在Firebase博客上找到这篇文章相当有用:组织您的支持Firebase的Android应用程序构建,因为它解释了如何部分地对崩溃报告进行静音。 发行说明通常会公布最新动态&更改。


We have followed the Add Firebase to your Android Project but we can't see the app receiving data in the Firebase Console.
And when we launch the app, the log says:

FirebaseInitProvider: FirebaseApp initialization unsuccessful

What does this mean? What are we doing wrong?
I can't find this error in the docs, nor here in StackOverflow.

解决方案

What does this mean? What are we doing wrong?

Would assume, that the authentication did not succeed.

a) the buildscript repositories and dependencies for the project level build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        // Android Build Tools Gradle Plugin
        classpath "com.android.tools.build:gradle:2.3.3"

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

b) the dependencies for the module level mobile/build.gradle (the Android Intel x86 images may still have the previous version of the Google Play Services installed, eg. 10.2.0 runs on the current x86 emulator, while 11.2.2 runs on my physical ARM device). referencing play-services and firebase-core will compile all their dependencies, unless excluding some them.

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 Library (in particular "play-services-auth")
    compile("com.google.android.gms:play-services:11.2.2") {}

    // Google Firebase Library
    compile("com.google.firebase:firebase-core:11.2.2") {}
}

c) the bottom line of mobile/build.gradle should be:

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

d) make sure to have the (downloaded) credentials available at app/google-services.json; on the Firebase Console, one has to add both SHA1 (or SHA256) hashes, of the debug and the release key-store, in order to have both builds authenticating properly; once all matches, it should report:

I/FirebaseInitProvider: FirebaseApp initialization successful

It's all well documented, just see Setup Google Play Services, Firebase Quickstart or Crash Reporting; while I find this article on the Firebase Blog quite useful: Organizing your Firebase-enabled Android app builds, because it explains how to partially mute the crash-reporting. The release notes always announce the updates & changes.

这篇关于FirebaseInitProvider:FirebaseApp初始化失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆