【问题标题】:ERROR: Project with path ':@react-native-firebase_app' could not be found in project ':@react-native-firebase_auth'错误:在项目 ':@react-native-firebase_auth' 中找不到路径为 ':@react-native-firebase_app' 的项目
【发布时间】:2019-08-21 18:36:39
【问题描述】:
安装 react-native-firebase 并添加模块身份验证后,在 Android Studio 中显示此错误:
错误:路径为 ':@react-native-firebase_app' 的项目不能
在项目 ':@react-native-firebase_auth' 中找到。
这是什么意思?
【问题讨论】:
标签:
firebase
react-native
firebase-authentication
【解决方案1】:
我也遇到了同样的问题。
我安装npm i @react-native-firebase/app后问题就解决了。
【解决方案2】:
您可以尝试以下方法:
-检查是否在 MainApplication.java 中以不正确的方式引用了 firebase 应用程序。
-删除模块并重新安装它们有时可能会解决问题。
【解决方案3】:
我认为您有不同版本的 firebase/app 和 firebase/auth。
只需进入 'node module/@react-native-firebase' 目录并检查 firebase/app 和 firebase/auth 的 package json 你会看到不同的版本。
如果你使用@react-native-firebase@6.2.0 也会出现这个问题
如果您在 6.2.0 版本中检查 firebase/auth 的 build.gradle
dependencies {
api project(':@react-native-firebase_app')
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-auth"
}
所以这是一个问题,它无法找到@firebase/app
@firebase/auth 依赖于 @firebase/app
在@6.3.4 中对我来说工作正常,有@firebase/auth 的build.gradle,如下所示
所以它能够找到@firebase/app
if (findProject(':@react-native-firebase_app')) {
api project(':@react-native-firebase_app')
} else if (findProject(':react-native-firebase_app')) {
api project(':react-native-firebase_app')
} else {
throw new GradleException('Could not find the react-native-firebase/app package, have you installed it?')
}
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-auth"
}