在Firebase项目中添加多个应用 [英] Adding multiple apps in a firebase project

查看:51
本文介绍了在Firebase项目中添加多个应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Firebase项目中添加了两个android应用,但是新添加的应用不断崩溃,并出现以下错误:

I have added two android apps in my firebase project, but the newly added app keeps crashing with following error:

Caused by: java.lang.IllegalStateException: Default FirebaseApp is not
initialized in this process com.x.y. Make sure to call
FirebaseApp.initializeApp(Context) first.

注意:我也尝试添加FirebaseApp.initializeApp(Context),但没有用.

Note : I tried adding FirebaseApp.initializeApp(Context) this too, but did not work.

在gradle文件中添加了依赖性:

Dependency added in gradle file:

{ ..... 


    def firebase_version = "16.0.1"

    implementation "com.google.firebase:firebase-core:$firebase_version"
    implementation "com.google.firebase:firebase-auth:$firebase_version"
    implementation "com.google.firebase:firebase-database:$firebase_version"
    implementation "com.google.firebase:firebase-analytics:$firebase_version"
    implementation "com.google.firebase:firebase-storage:$firebase_version"

}

推荐答案

对我来说,任何解决方案都无法在任何地方使用.仅此有效.只需将我的Google服务的等级从4.1.0下载到4.0.0在两个gradle文件中进行更改.

For me none of the solution worked that were given any where. Only this worked. Just had to download grade my google services from 4.1.0 to 4.0.0 Change it in both gradle files.

dependencies {
    classpath 'com.google.gms:google-services:4.0.0'
    /*classpath 'com.google.gms:google-services:4.1.0' <-- this was the problem */
}

因此,如果您更新了Google服务,请尝试降级或更改为较旧的版本.希望对您有帮助

So if you have updated the google services, just try to downgrade or change to an older version. Hope it helps

这篇关于在Firebase项目中添加多个应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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