默认 FirebaseApp 在此过程中不会初始化.请确保先调用 FirebaseApp.initializeApp(C



默认的FirebaseApp在此过程中未初始化。请确保先调用 FirebaseApp.initializeApp(Context(。

我已经尝试了很多东西,但我无法在设备中收到通知。

我也尝试了以下东西。

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

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

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

对我来说

,任何地方给出的解决方案都不起作用。只有这样才奏效。只需要将我的谷歌服务从 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 */
}

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

确保:

  1. AndroidManifest.xml中的包名称与google-services.json中的包名称相同
  2. google-services.json生成操作设置为GoogleServicesJson
  3. 在步骤 2 之后,重新启动 IDE 并清理并重建
  4. LoadApplication(..)之前显式调用FirebaseApp.InitializeApp(Application.Context); MainActivity.OnCreate

将插件添加到build.gradle(应用程序级别(

在底部添加这个

对我来说
apply plugin: 'com.google.gms.google-services'

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

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

添加此插件后,您可以尝试对方的建议。

com.google.gms:google-services升级到最新版本,将得到解决。

升级

com.google.gms:google-services

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

它对我有用。

我最近遇到了这个问题,并找到了一个适合我的解决方案:

我一直在为 net7.0-android33.0 开发,我刚刚意识到我在我的 .csproj 中添加了一个特定的 PropertyGroup 条件,用于该目标框架,我在其中设置了不同的 ApplicationId

我的Google-Services.json是用以前的ApplicationId创建的,所以我在Firebase中用正确的ApplicationId生成了一个新应用程序,它工作了。

也许这有点傻,但我已经坚持了几天,所以它可能会帮助某人

相关内容

最新更新