Java React本机firebase连接工作不正常

Java React本机firebase连接工作不正常,java,android,react-native,react-native-android,Java,Android,React Native,React Native Android,我已经放弃了这些步骤,并观看了一些关于如何将react本机应用程序连接到firebase的视频。 但我还是得到了这个错误: Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app(). Ensure you have: 1) imported the 'io.invertase.firebase.app.ReactNat

我已经放弃了这些步骤,并观看了一些关于如何将react本机应用程序连接到firebase的视频。 但我还是得到了这个错误:

Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app().

Ensure you have:

1) imported the 'io.invertase.firebase.app.ReactNativeFirebaseAppPackage' module in your 'MainApplication.java' file.

2) Added the 'new ReactNativeFirebaseAppPackage()' line inside of the RN 'getPackages()' method list.

See http://invertase.link/android for full setup instructions.
▶ 4 stack frames were collapsed.
App
C:/Users/saadb/Desktop/Smart-Mirror-App/App.js:8
   5 | 
   6 | export default function App() {
   7 | 
>  8 |   const users = firestore()
   9 |     .collection('Users')
  10 |     .get();
因此,我尝试修复错误并将其添加到我的主应用程序中

 import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
 import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;

 @Override
protected List<ReactPackage> getPackages() {
  @SuppressWarnings("UnnecessaryLocalVariable")
  List<ReactPackage> packages = new PackageList(this).getPackages();
  packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
  packages.add(new RNFirebaseMessagingPackage());
  packages.add(new RNFirebaseNotificationsPackage());
  return packages;
}
导入io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
导入io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
@凌驾
受保护的列表getPackages(){
@抑制警告(“不必要的局部变量”)
List packages=new PackageList(this).getPackages();
add(新的ModuleRegistryAdapter(mModuleRegistryProvider));
packages.add(新的RNFirebaseMessagingPackage());
packages.add(新的RNFirebaseNotificationsPackage());
退货包裹;
}
这是我的App.js文件

import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import firestore from '@react-native-firebase/firestore';

export default function App() {

  const users = firestore()
    .collection('Users')
    .get();

  // console.log(users);

  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
从“世博会状态栏”导入{StatusBar};
从“React”导入React;
从“react native”导入{样式表、文本、视图};
从“@react native firebase/firestore”导入firestore;
导出默认函数App(){
const users=firestore()
.collection('用户')
.get();
//console.log(用户);
返回(
打开App.js开始使用你的应用程序!
);
}
const styles=StyleSheet.create({
容器:{
弹性:1,
背景颜色:“#fff”,
对齐项目:“居中”,
为内容辩护:“中心”,
},
});
我还添加了所有依赖项和包以及google.json文件,如说明所示。 有人能帮我解决这个问题吗