arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1k stars 1.55k forks source link

Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh [...]colors.xml" already exists! #953

Open JoshTor opened 5 years ago

JoshTor commented 5 years ago

Hi ! I don't know why the plugin don't want to install ..

I tried step by step with and without the google-services.json file generate on firebase :

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!

I don't understant what's wrong...

JoshTor commented 5 years ago

Nobody have the solution ..? Please help I found nothing ...

Borja4 commented 5 years ago

It's probably a conflict with other plugin... try to create a brand new cordova project and install only this plugin. After that, install one by one the other plugins to find which one is the source of the error. Hope it helps.

kevinswartz commented 5 years ago

I'm having the same problem here today. If I remove my reference to colors.xml from my config.xml I'm able to install the plugin, but this obviously screws up notification colors.

From config.xml:

<resource-file src="resources/android/colors.xml" target="app/src/main/res/values/colors.xml" />
<config-file parent="/manifest/application" target="AndroidManifest.xml">
       <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/primary" />
</config-file>

Any workaround here? I'm not sure how to use the firebase plugin and not have broken notification colors for now.

Ionic:

   ionic (Ionic CLI) : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework   : ionic1 1.3.5
   @ionic/v1-toolkit : 1.0.22

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-webview 2.4.1, (and 23 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/xxxxxx/Library/Android/sdk)
   ios-deploy        : 2.0.0
   ios-sim           : 6.1.2
   NodeJS            : v8.11.3 (/usr/local/bin/node)
   npm               : 5.6.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2 Build version 10E125
jordanorc commented 5 years ago

I'm having the same problem faced by @kevinswartz. I need to create some custom colors, but this plugin creates the file colors.xml. When I try to update the file, this error occurs. @kevinswartz, did you find a workaround for this?

kevinswartz commented 5 years ago

Hey @jordanorc I did, but my workaround sucks. Basically you can't rely on cordova to install the firebase plugin properly when restoring a platform. So before you add your platform, remove the firebase plugin, and remove those lines referencing colors.xml from your config.xml. Once the platform has been added, add the colors.xml lines back to your config, then re-add the firebase plugin. I would LOVE a better option, as this pretty much ruins my build process.

jordanorc commented 5 years ago

@kevinswartz, thank you for the response. I found a solution using config-file:

<config-file parent="/resources" target="app/src/main/res/values/colors.xml">
    <color name="notification">#0B6E45</color>
</config-file>

When building the application for the first time, a warning message will appear:

config file app/src/main/res/values/colors.xml requested for changes not found at .../platforms/android/app/src/main/res/values/colors.xml, ignoring

However, the file will be merged as requested during the build process. So, it works as expected. My settings are:

Ionic:

   ionic (Ionic CLI)  : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-webview 1.2.1, (and 22 other plugins)

System:

   Android SDK Tools : 26.1.1 (/home/xxxx/Android/Sdk)
   NodeJS            : v8.11.4 (/usr/bin/node)
   npm               : 6.5.0
   OS                : Linux 4.18
kevinswartz commented 5 years ago

@jordanorc Good idea! I'll try that out.

kevinswartz commented 5 years ago

Just to follow up on the workaround from @jordanorc . It's working for me here. Here's the lines I used for notitication colors in my config.xml:

<config-file parent="/resources" target="app/src/main/res/values/colors.xml">
   <color name="custom_primary">#FF007CD3</color>
</config-file>
<config-file parent="/manifest/application" target="AndroidManifest.xml">
   <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/custom_primary" />
</config-file>
jordanorc commented 5 years ago

Excellent news @kevinswartz. I'm glad I could help.

Mehuge commented 6 months ago

I am hitting this issue, and I don't have a config.xml and firebase is the only plugin being installed.