【问题标题】:Where the file "firebase.json" goes in React-Native-Firebase V6文件“firebase.json”在 React-Native-Firebase V6 中的位置
【发布时间】:2020-01-16 18:21:32
【问题描述】:

React-Native-Firebase V6 文档没有指定在哪里创建文件 firebase.json


"dependencies": {
    "@react-native-firebase/admob": "^0.4.1",
    "@react-native-firebase/app": "^0.1.2",
    "@react-native-firebase/auth": "^0.1.2",
    "@react-native-firebase/firestore": "^0.1.2",
    "matter-js": "^0.14.2",
    "react": "16.8.6",
    "react-native": "0.60.3",
    "react-native-elements": "^1.1.0",
    "react-native-game-engine": "^0.11.5",
    "react-native-gesture-handler": "^1.3.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-progress": "^3.6.0",
    "react-native-radial-gradient": "^1.0.5",
    "react-native-share": "^2.0.0",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^3.11.1"
 },

控制台出现以下错误:

  • 地点:

    • 构建文件 'D:\Jesus\IFEEP AT\StoreClicker\StoreSkinClicker\node_modules@react-native-firebase\admob\android\build.gradle' 行:44

  • 出了什么问题:

    • 评估项目“:@react-native-firebase_admob”时出现问题。 没有方法签名:java.util.LinkedHashMap.getStringValue() 适用于参数类型:(String, String) 值:[admob_app_id, ]

【问题讨论】:

  • firebase.json 文件由 Firebase CLI 使用。我没有立即在您收到的消息中看到任何表明需要firebase.json 的内容。你确定你不是指google-services.json
  • 在 react-native-firebase 文档中它说 Add the ID to your root level firebase.json file under the react-native object: { "react-native": { "admob_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx" } }
  • 有趣。我猜他们在构建期间使用该文件。那就是说它需要在根目录中,所以你把它放在你项目的根目录中了吗?
  • 是的,我把它放在我项目的根目录下。在我的 package.json 所在的同一个地方

标签: javascript firebase react-native


【解决方案1】:

firebase.json 需要进入你的 react-native 项目的根目录。与package.json同级。

如果你为 ios 运行 pod install 它会输出一行:

Using firebase.json from '<Path_To_Project>/firebase.json'

我把它解释为正确的位置...

这就是你的 firebase.json 的样子:

{
  "react-native": {
    "ml_vision_face_model": true,
    "ml_vision_ocr_model": true,
    "ml_vision_barcode_model": true,

    "ml_vision_label_model": true,
    "ml_vision_image_label_model": true
  }
}

【讨论】:

  • 这确实应该在文档中的某个地方。
  • 我用的是v7,没有firebase.json文件
【解决方案2】:

.JSON 文件通常保存在 react native 项目的本地文件夹中的根目录中,而在 android 中,我们将其保存在 app 文件夹中,并尝试为它们提供相对路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-21
    • 2020-10-03
    • 1970-01-01
    • 2020-09-26
    • 1970-01-01
    • 1970-01-01
    • 2019-04-13
    • 2020-11-03
    相关资源
    最近更新 更多