簡體   English   中英

Ionic 3 錯誤:“文件 google-services.json 丟失。沒有它,Google 服務插件將無法運行。” 在離子cordova中構建/准備android

[英]Ionic 3 Error: "File google-services.json is missing. The Google Services Plugin cannot function without it." in ionic cordova build/prepare android

我正在嘗試在我的 Ionic 3 項目中執行ionic cordova build android命令,但遇到了File google-services.json is missing. The Google Services Plugin cannot function without it. File google-services.json is missing. The Google Services Plugin cannot function without it.

這是我的控制台中的跟蹤:

> File google-services.json is missing. The Google Services Plugin cannot function without it.
   Searched Location:
  C:\Users\Bryan\Desktop\iSpace\iSpaceProject\platforms\android\app\src\nullnull\debug\google-services.json
  C:\Users\Bryan\Desktop\iSpace\iSpaceProject\platforms\android\app\src\debug\nullnull\google-services.json
  C:\Users\Bryan\Desktop\iSpace\iSpaceProject\platforms\android\app\src\nullnull\google-services.json
  C:\Users\Bryan\Desktop\iSpace\iSpaceProject\platforms\android\app\src\debug\google-services.json
  C:\Users\Bryan\Desktop\iSpace\iSpaceProject\platforms\android\app\src\nullnullDebug\google-services.json
  C:\Users\Bryan\Desktop\iSpace\iSpaceProject\platforms\android\app\google-services.json

我在網上找到的許多答案是下載google-services.json文件並將其放在我的 platform/android/app 文件夾中。 但是,由於我的 firebase 應用程序是Web 應用程序,我無法從那里下載google-services.json文件。 我所能做的就是將 firebase 配置復制到我的 html 頁面。

當我嘗試搜索我的文件目錄時,我也找不到任何與google-service.json相關的文件。

請在這件事上給予我幫助! 我的目標是能夠在android studio 的 emulator運行該應用程序

請注意,我的 firebase 應用程序是一個Web 應用程序,無法直接從 firebase 控制台下載google-service.json文件。

在 Firebase 控制台中,在項目的項目設置下,您將找到應用程序的配置。

由於您的項目當前配置為 Web 應用程序,因此您需要初始化您的項目以面向其他平台(例如 Android)。

在頁面右側大約一半的位置,您會找到一個Add app按鈕,您可以通過該按鈕選擇 Android,對其進行配置,然后生成google-services.json文件。

  1. 步驟 1 - 打開“項目設置”並單擊“添加應用程序”按鈕
  2. 第 2 步- 選擇平台 - Android,在本例中
  3. 第 3 步- 遵循配置向導

我找到了解決方案!

我通過執行cordova plugin remove cordova-support-google-services並且它設法構建。 我也嘗試在Android Studio上運行它,並且效果很好!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM