Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 为什么cordova构建android错误?_Ionic Framework_Ionic2 - Fatal编程技术网

Ionic framework 为什么cordova构建android错误?

Ionic framework 为什么cordova构建android错误?,ionic-framework,ionic2,Ionic Framework,Ionic2,为什么每次运行命令cordova build android时都会出错 exe:cordova构建android 示例CMD: 失败:生成失败,出现异常 出了什么问题: 任务“:app:processDebugGoogleServices”的执行失败 缺少文件google-services.json。没有它,谷歌服务插件就无法运行。 搜索位置: C:\Users\Asus\Desktop\table\platforms\android\app\src\debug\google-services.

为什么每次运行命令cordova build android时都会出错

exe:cordova构建android

示例CMD: 失败:生成失败,出现异常

出了什么问题: 任务“:app:processDebugGoogleServices”的执行失败

缺少文件google-services.json。没有它,谷歌服务插件就无法运行。 搜索位置: C:\Users\Asus\Desktop\table\platforms\android\app\src\debug\google-services.json C:\Users\Asus\Desktop\table\platforms\android\app\google-services.json

尝试: 使用-stacktrace选项运行以获取堆栈跟踪。使用-info或-debug选项运行以获得更多日志输出

得到更多的帮助

2秒内生成失败 18项可执行任务:18项已执行 节点:20776未处理PromisejectionWarning:未处理的承诺拒绝id:1:错误:cmd:命令失败,退出代码为1错误输出: 失败:生成失败,出现异常

出了什么问题: 任务“:app:processDebugGoogleServices”的执行失败。
看起来你正在尝试使用一个插件,它利用了一个或多个谷歌服务,但是你丢失了你的信息文件


为了使这些能够正常构建和工作,您需要在项目的根目录中包含适用于Android的Google服务信息文件Google-services.json和/或适用于iOS的Google服务信息文件Google-info.plist。检查以确保文件在那里,如果没有,则需要从正在使用的服务下载该文件,并将其放置在项目的根目录中。

我发现使用cordova plugin fcm从6.3.0升级到phonegap 7.0.0时出现类似错误。我解决了在\plugins\cordova plugin fcm\scripts.js中编辑fcm\u config\u files\u process.js第58行的问题

fs.writeFileSync("platforms/android/google-services.json", contents);
fs.writeFileSync("platforms/android/app/google-services.json", contents);