phonegap-plugin-push变量在构建时缺少SENDER_ID

时间:2017-12-14 06:54:10

标签: android cordova phonegap-build phonegap phonegap-pushplugin

我正在使用Phonegap v7.1.1开发Android应用。要实现推送通知,我使用phonegap-plugin-push v2.1.2。 我按照自述文件中提到的所有步骤进行了操作。

但是,在命令行中运行phonegap build android时,我收到以下错误:

Failed to install 'phonegap-plugin-push': Error: Variable(s) missing: SENDER_ID
at Object.mergeVariables (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\src\plugman\variable-merge.js:58:15)
at C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\src\plugman\install.js:315:44
at _fulfilled (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:749:13)
at C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:557:44
at flush (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

错误:缺少变量:SENDER_ID

google-services.json在root中,我在config.xml中添加了这部分代码。

<platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>
<preference name="android-build-tool" value="gradle" />
<plugin name="phonegap-plugin-push" spec="~1.8.4">
    <variable name="SENDER_ID" value="xxxxxxxxxxx" />
</plugin>

如果有人可以指出我出错的地方,那将会非常有帮助。谢谢。

0 个答案:

没有答案