![](/img/trans.png)
[英]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 ionic 3
我正在使用 FCM 进行推送通知我总是收到此错误消息
“文件 google-services.json 丢失。没有它 ionic 3,Google 服务插件无法运行”
在电话上,我已将 google-services.json 放在每个文件夹中,但没有任何工作
首先你需要下载 google-services.json:
( https://support.google.com/firebase/answer/7015592 )
好的,现在您必须安装cordova-support-google-services:
cordova plugin add cordova-support-google-services --save
然后,你必须把google-services.json放在你项目的根目录下(www文件夹外,同级),然后resource-file标签将其复制到platforms/android/app/
接下来,放入config.xml
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
...
</platform>
注意:如果您使用低于版本 7 的cordova-android,请改为指定:
目标=“google-services.json”
现在再次尝试构建!
如前所述,需要将google-services.json
复制到正确的位置。 位置最近更改为app/google-services.json
。 所以config.xml
需要相应地适应
<resource-file src="google-services.json" target="app/google-services.json" />
让我们假设您将 google-services.json 放在 src/app 文件夹中 所以相对于您的 ionic 项目,它位于src/app/google-services.json
现在,为了确保将其复制到构建的正确位置,您必须向 config.xml 文件中添加一行代码。
<resource-file src="src/app/google-services.json" target="app/google-services.json" />
请注意,此行的src属性应相应地反映 google-service.json 文件的相对路径。
就这么简单
将google-services.json
文件放在项目的根目录中,并通过将此行添加到config.xml
文件(在<platform name="android">...</platform>
之间)将其复制到www
目录<platform name="android">...</platform>
标签):
<resource-file src="google-services.json" target="google-services.json" />
然后再次运行ionic cordova prepare android
。
我已将google-services.json
放在Platforms/Android/
文件夹中并run ionic cordova build android
。 它的工作。
您必须将 google-services.json 文件复制到平台/android/app 文件夹中。 执行 android run 会正常工作。
(您可以从 firbase 项目设置下载 google-services.json。
将您的google-services.json
复制到您的ionicProject/src
然后再次尝试删除并重新安装ionic-firebase
插件。
在 config.xml 文件所在的位置添加google-services.json文件
然后将这一行添加到 config.xml 文件中
<platform name="android">
<resource-file src="google-services.json" target="google-services.json" />
然后转到Project/platforms/android并添加google-services.json文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.