android - 安装失败 'cordova-plugin-firebase' : CordovaError: Uh oh

标签 android firebase cordova cordova-plugins

我已按照这些步骤将配置 firebase 安装到我的 cordova 项目以进行云消息传递。 https://medium.com/@felipepucinelli/how-to-add-push-notifications-in-your-cordova-application-using-firebase-69fac067e821

我有 google-services.json 文件并添加到我的项目的根路径中。要安装 cordova-plugin-firebase,我尝试粘贴:

<plugin name="cordova-plugin-firebase" spec="^2.0.0" />

进入 config.xml 并运行 cordova platform 添加 android@6.4.0 。

输出:

Installing "cordova-plugin-firebase" for android
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh!
"C:\Users\myAppName\application\platforms\android\google-services.json" already exists!

编辑: 一步一步尝试:

cordova platform rm android

cordova plugin rm cordova-plugin-firebase --save

cordova plugins
com.unarin.cordova.beacon 3.6.1 "Proximity Beacon Plugin"
cordova-open-native-settings 1.5.1 "Native settings"
cordova-plugin-badge 0.8.7 "Badge"
cordova-plugin-barcodescanner 0.7.4 "BarcodeScanner"
cordova-plugin-bluetoothle 4.4.3 "Bluetooth LE"
cordova-plugin-call-number 1.0.1 "Cordova Call Number Plugin"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-email 1.2.7 "EmailComposer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-open-blank 0.0.2 "Open Blank"
cordova-plugin-splashscreen 5.0.3-dev "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.0 "SocialSharing"
cordova.plugins.diagnostic 4.0.6 "Diagnostic"
es6-promise-plugin 4.2.2 "Promise"

cordova platform add android@6.4.0

cordova plugin add cordova-plugin-firebase --save
Installing "cordova-plugin-firebase" for android
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh!
"C:\Users\myProject\application\platforms\android\res\values\colors.xml" already exists!
    at copyNewFile (C:\Users\myProject\application\platforms\android\cordova\lib\pluginHandlers.js:245:45)
    at install (C:\Users\myProject\application\platforms\android\cordova\lib\pluginHandlers.js:43:17)
    at ActionStack.process (C:\Users\myProject\application\platforms\android\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
    at PluginManager.doOperation (C:\Users\myProject\application\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:114:20)
    at PluginManager.addPlugin (C:\Users\myProject\application\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:144:17)
    at C:\Users\myProject\application\platforms\android\cordova\Api.js:243:74
    at _fulfilled (C:\Users\myProject\application\platforms\android\cordova\node_modules\q\q.js:854:54)
    at self.promiseDispatch.done (C:\Users\myProject\application\platforms\android\cordova\node_modules\q\q.js:883:30)
    at Promise.promise.promiseDispatch (C:\Users\myProject\application\platforms\android\cordova\node_modules\q\q.js:816:13)
    at C:\Users\myProject\application\platforms\android\cordova\node_modules\q\q.js:570:49
Uh oh!
"C:\Users\myProject\application\platforms\android\res\values\colors.xml" already exists!

我不明白哪里出了问题......

最佳答案

根据 issue #25 ...

in your config.xml first install cordova-plugin-firebase then cordova-plugin-push-notification or phonegap-plugin-push. make sure to first remove both plugins from plugins folder after removing platform.

这是因为这两个插件发生冲突,因为它们都试图安装该文件。

关于android - 安装失败 'cordova-plugin-firebase' : CordovaError: Uh oh,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53498396/

相关文章:

javascript - 将 Microsoft OAuth 身份验证限制为仅对 Web 应用程序进行身份验证,而不是对所有 Microsoft 服务进行身份验证

c# - Windows 10 Mobile (10.0.14393) 地理围栏后台任务 (LocationTrigger)

jquery-mobile - 带有上一页后退按钮的 jQuery Mobile NavBar

android - 有没有办法知道我在特定版本上具有的每个gradle依赖版本?

android - 获取应用程序崩溃和 ANR 的日志?

android - 如何使工具栏上的操作菜单居中

android - 是否可以将多个 BT 耳机与 Android 设备配对并向它们传输声音?

android - 创建 Google Play 产品和应用内结算

java - 只是想知道我的 ListView 是否将用户引导到每个项目的新屏幕单击

javascript - Error().stack 在 Cordova iOS 中未定义,但适用于 Android?