简体   繁体   English

文件 google-services.json 丢失。 如果没有 ionic 3,Google 服务插件将无法运行

[英]File google-services.json is missing. The Google Services Plugin cannot function without it ionic 3

I am using FCM for push notification I always get this error message我正在使用 FCM 进行推送通知我总是收到此错误消息

"File google-services.json is missing. The Google Services Plugin cannot function without it ionic 3" “文件 google-services.json 丢失。没有它 ionic 3,Google 服务插件无法运行”

on phone I have placed my google-services.json on every folder and nothings working在电话上,我已将 google-services.json 放在每个文件夹中,但没有任何工作

Fist of all you need to download google-services.json:首先你需要下载 google-services.json:

  1. Sign in to Firebase and open your project.登录 Firebase 并打开您的项目。
  2. Click the Settings icon and select Project settings.单击设置图标并选择项目设置。
  3. In the Your apps card, select the package name of the app you need a config file for from the list.在您的应用程序卡中,从列表中选择您需要配置文件的应用程序的包名称。
  4. Click google-services.json.单击 google-services.json。

( https://support.google.com/firebase/answer/7015592 ) ( https://support.google.com/firebase/answer/7015592 )

Ok now you have to install cordova-support-google-services:好的,现在您必须安装cordova-support-google-services:

cordova plugin add cordova-support-google-services --save

Then, you have to put the google-services.json in the root of your project (outside www folder, at the same level), and then the resource-file tag will copy it to platforms/android/app/然后,你必须把google-services.json放在你项目的根目录下(www文件夹外,同级),然后resource-file标签将其复制到platforms/android/app/

Next, put in the config.xml接下来,放入config.xml

<platform name="android">
    <resource-file src="google-services.json" target="app/google-services.json" />
 ... 
 </platform>

Note: if you use cordova-android below version 7 specify instead:注意:如果您使用低于版本 7 的cordova-android,请改为指定:

target="google-services.json"目标=“google-services.json”

Now try again to build!现在再次尝试构建!

As mentioned before google-services.json needs to be copied to the proper location.如前所述,需要将google-services.json复制到正确的位置。 the location changed recently to app/google-services.json .位置最近更改为app/google-services.json So the config.xml needs to be adapted accordingly to所以config.xml需要相应地适应

<resource-file src="google-services.json" target="app/google-services.json" />

Lets' assume you put the google-services.json in src/app folder So relativly to your ionic project it is located at src/app/google-services.json让我们假设您将 google-services.json 放在 src/app 文件夹中 所以相对于您的 ionic 项目,它位于src/app/google-services.json

Now, to be sure it will be copied to the correct location of the build, you have to add a line of code to the config.xml file.现在,为了确保将其复制到构建的正确位置,您必须向 config.xml 文件中添加一行代码。

<resource-file src="src/app/google-services.json" target="app/google-services.json" />

Note that the src property of this line should reflect the relative path of the google-service.json file accordingly.请注意,此行的src属性应相应地反映 google-service.json 文件的相对路径。

That's as simple as that就这么简单

Place the google-services.json file in your project's root and make sure it will be copied to the www directory by adding this line to the config.xml file (between the <platform name="android">...</platform> tags):google-services.json文件放在项目的根目录中,并通过将此行添加到config.xml文件(在<platform name="android">...</platform>之间)将其复制到www目录<platform name="android">...</platform>标签):

<resource-file src="google-services.json" target="google-services.json" />

then run ionic cordova prepare android again.然后再次运行ionic cordova prepare android

From your dropdown select从您的下拉列表中选择

  • project项目
  • then go to app folder然后转到应用程序文件夹
  • then paste your file inside app folder.然后将您的文件粘贴到 app 文件夹中。
  • clean build and rebuild again清理构建并再次重建

在此处输入图片说明

I have placed google-services.json in Platforms/Android/ folder and run ionic cordova build android .我已将google-services.json放在Platforms/Android/文件夹中并run ionic cordova build android Its working.它的工作。

You have to copy the google-services.json file into platforms/android/app folder.您必须将 google-services.json 文件复制到平台/android/app 文件夹中。 Executing a android run will work fine.执行 android run 会正常工作。

(You can download the google-services.json from firbase project settings. (您可以从 firbase 项目设置下载 google-services.json。

将您的google-services.json复制到您的ionicProject/src然后再次尝试删除并重新安装ionic-firebase插件。

Add google-services.json file where the config.xml file is在 config.xml 文件所在的位置添加google-services.json文件

Then add this line to the config.xml file然后将这一行添加到 config.xml 文件中

<platform name="android">
         <resource-file src="google-services.json" target="google-services.json" />

Then go to Project/platforms/android and add the google-services.json file然后转到Project/platforms/android并添加google-services.json文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 文件google-services.json丢失。 没有它,Google Services插件将无法运行 - File google-services.json is missing. The Google Services Plugin cannot function without it 错误:文件 google-services.json 丢失。 没有它,Google 服务插件就无法运行。 - Error: File google-services.json is missing. The Google Services Plugin cannot function without it. Android -File google-services.json丢失了。没有它,Google Services插件无法运行 - Android -File google-services.json is missing. The Google Services Plugin cannot function without it 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 由以下原因引起:org.gradle.api.GradleException:文件 google-services.json 丢失。 没有它,谷歌服务插件就不能 function - Caused by: org.gradle.api.GradleException: File google-services.json is missing. The Google Services Plugin cannot function without it 文件 google-services.json 丢失。 没有它,Google 服务插件就无法运行。 (用于 firebase ml 套件) - File google-services.json is missing. The Google Services Plugin cannot function without it. (For firebase ml kit) 没有它,Google Services插件将无法运行,因为它缺少google-services.json - The Google Services Plugin cannot function without it because it is missing google-services.json 模块根文件夹中缺少文件 google-services.json。 没有它 Google 服务插件就无法运行 - File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it Android Studio Gradle“文件google-services.json缺少模块根目录。 没有它,Google Services插件将无法运行。” - Android Studio Gradle“File google-services.json missing module root. The Google Services Plugin cannot function without it.” 生成错误-模块根文件夹中缺少文件google-services.json。 没有它,Google Services插件将无法运行 - Build error - File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM