我在Android上使用Firebase,我试图通过以下方式实例化Firestore:FirebaseFirestore rootRef = FirebaseFirestore.getInstance()
但是我得到Null指针异常
p.s。:如果我没有实例化FirebaseApp FirebaseApp.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.
[EDITED]
APP build.gradle:
PROJECT build.gradle:
有什么建议?
在获取实例之前使用Firebase初始化应用程序
FirebaseApp.initializeApp(this);
FirebaseFirestore rootRef = FirebaseFirestore.getInstance()