Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
默认FirebaseApp在此过程中未初始化。确保首先调用FirebaseApp.initializeApp(上下文)_Firebase_Xamarin_Xamarin.forms - Fatal编程技术网

默认FirebaseApp在此过程中未初始化。确保首先调用FirebaseApp.initializeApp(上下文)

默认FirebaseApp在此过程中未初始化。确保首先调用FirebaseApp.initializeApp(上下文),firebase,xamarin,xamarin.forms,Firebase,Xamarin,Xamarin.forms,默认FirebaseApp在此过程中未初始化。确保首先调用FirebaseApp.initializeAppContext 我尝试过很多东西,但无法在设备中获得通知 我也试过下面的东西 在属性窗格中,在解决方案资源管理器窗口中设置构建操作选择google-services.json 在属性窗格中,如果未显示GoogleServicesJson生成操作,请将生成操作设置为GoogleServicesJson,保存并关闭解决方案,然后重新打开它:to GoogleServicesJson 通知以前是

默认FirebaseApp在此过程中未初始化。确保首先调用FirebaseApp.initializeAppContext

我尝试过很多东西,但无法在设备中获得通知

我也试过下面的东西

在属性窗格中,在解决方案资源管理器窗口中设置构建操作选择google-services.json

在属性窗格中,如果未显示GoogleServicesJson生成操作,请将生成操作设置为GoogleServicesJson,保存并关闭解决方案,然后重新打开它:to GoogleServicesJson

通知以前是有效的,但在我将xamarin表单更新为2.5.0.280555和xamarin.Firebase.Messaging.42.1021.1后,它停止工作。

请确保:

AndroidManifest.xml中的包名与google-services.json中的包名相同 google-services.json构建操作设置为GoogleServicesJson 第2步后,重新启动IDE并清理和重建 显式调用FirebaseApp.InitializeAppApplication.Context;在MainActivity.OnCreate中,在LoadApplication之前。。
对我来说,任何地方给出的解决方案都不起作用。只有这样才有效。 只是不得不将我的谷歌服务从4.1.0降级到4.0.0

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
    classpath 'com.google.gms:google-services:4.0.0'
    /*classpath 'com.google.gms:google-services:4.1.0' <-- this was the problem */
}
因此,如果你已经更新了谷歌服务,只需尝试降级或更改为旧版本。
希望它有助于将插件添加到build.gradle应用程序级别

//在底部加上这个

apply plugin: 'com.google.gms.google-services'
升级com.google.gms:google services至最新版本,问题将得到解决。

升级

gms:googleservices

到了最新版本,它将被解决


这对我来说很有效。

对我来说,当我忘记在应用程序模块中添加第二个插件时就会发生这种情况

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'  // Google Services plugin

添加此插件后,您可以尝试其他人的建议。

在我的情况下,我必须升级到com.google.gms:google services:4.2.0,我可以使用Firebase运行我的应用程序,但在强制关闭并重新启动后,我遇到了此崩溃。在my build.gradle的底部添加apply插件修复了崩溃。有时会发生这种情况,因为包名在google-services.json中不匹配