无法启动活动组件信息.java.lang.NullPointer异常:Firestore 组件不存在



我在Android上使用Firebase,我正在尝试通过以下方式实例化Firestore:FirebaseFirestore rootRef = FirebaseFirestore.getInstance()但是我收到空指针异常

p.s.:如果我不即时使用FirebaseAppFirebaseApp.initializeApp(this)), I get the error: "java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process. Make sure to call FirebaseApp.initializeApp(Context) first.

[已编辑]

APP build.gradle:

https://pastebin.com/k7e0Vzy4

PROJECT build.gradle:

https://pastebin.com/hMjwpAK9

有什么建议吗?

在获取实例之前使用 Firebase 初始化应用程序

FirebaseApp.initializeApp(this);
FirebaseFirestore rootRef = FirebaseFirestore.getInstance()

最新更新