firebase.initializeApp() 对比 FirebaseApp.initializeApp()
firebase.initializeApp() vs FirebaseApp.initializeApp()
我目前正在尝试使用来自 'expo-notifications' 的 Notifications 包设置推送通知,我只是收到以下错误,我无法解决它:
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Default FirebaseApp is not initialized in this process com.-----.-----. Make sure to call FirebaseApp.initializeApp(Context) first.]
问题是,这条消息完全激怒了我,因为我打电话给:
import * as firebase from "firebase";
之后:
firebase.initializeApp(ApiKeys);
在我的应用程序开始时。
我现在是否需要安装 Firebase/App 软件包才能执行 FirebaseApp.initializeApp()
?那我需要初始化我的应用程序 2 次吗?
expo 的文档都没有提到这样的错误,我也没有在 firebase 文档中发现任何与此错误相关的内容,我真的很纠结这个问题。
Aperently 有一个导入到 app/build.gradle 文件中,expo 文档中根本没有提到。它缺少以下行:
implementation("com.google.firebase:firebase-iid")
您需要将它放入您的 app/build.gradle 文件中以使其工作。
I found it in the following forum, the posts are just one month old so its a quite new bug.
我目前正在尝试使用来自 'expo-notifications' 的 Notifications 包设置推送通知,我只是收到以下错误,我无法解决它:
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Default FirebaseApp is not initialized in this process com.-----.-----. Make sure to call FirebaseApp.initializeApp(Context) first.]
问题是,这条消息完全激怒了我,因为我打电话给:
import * as firebase from "firebase";
之后:
firebase.initializeApp(ApiKeys);
在我的应用程序开始时。
我现在是否需要安装 Firebase/App 软件包才能执行 FirebaseApp.initializeApp()
?那我需要初始化我的应用程序 2 次吗?
expo 的文档都没有提到这样的错误,我也没有在 firebase 文档中发现任何与此错误相关的内容,我真的很纠结这个问题。
Aperently 有一个导入到 app/build.gradle 文件中,expo 文档中根本没有提到。它缺少以下行:
implementation("com.google.firebase:firebase-iid")
您需要将它放入您的 app/build.gradle 文件中以使其工作。
I found it in the following forum, the posts are just one month old so its a quite new bug.