在 Android 上未找到 RNFirebase 核心模块,确保您已正确添加 RNFirebase 和 Firebase gradle 依赖项

RNFirebase core module was not found natively on Android, ensure you have correctly added the RNFirebase and Firebase gradle dependencies

我遇到这个奇怪的错误已经有一个小时了,但我无法修复它。我有我需要的所有依赖项。

Error

dependencies {
    implementation project(':react-native-firebase')
    implementation project(':react-native-code-push')
    implementation project(':react-native-sentry')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-iap')
    implementation project(':react-native-amplitude-analytics')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.google.android.gms:play-services-base:16.0.1"
    implementation "com.google.firebase:firebase-core:16.0.6"
    implementation "com.google.firebase:firebase-ads:15.0.1"
    implementation "com.google.firebase:firebase-config:16.1.2"
    implementation "com.google.firebase:firebase-messaging:17.3.4"

    implementation "com.google.firebase:firebase-auth:9.6.1"
    implementation "com.google.firebase:firebase-database:9.6.1"

    implementation "com.google.firebase:firebase-messaging:17.3.0"
    implementation "com.google.firebase:firebase-core:16.0.3"
    implementation "com.google.firebase:firebase-auth:16.0.3"
    implementation "com.google.firebase:firebase-database:16.0.1"
}

确保您已将此行包含在 MainApplication.java

import io.invertase.firebase.RNFirebasePackage;

 @Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      new RNFirebasePackage(), <----- this
  );
}