Cordova-plugin-firebase: Error on build

Created on 28 Jul 2016  路  11Comments  路  Source: arnesson/cordova-plugin-firebase

After I add this plugin to my Cordova project, I got an error Message:

MDAVSCLI : error : Uh oh!
Executing "before_plugin_install" hook for "cordova-plugin-firebase" on android.
Install start for "cordova-plugin-firebase" on android.
Beginning processing of action stack for android project...
"(ProjectPath)\platforms\android\google-services.json" already exists!
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

My Environment:

  • cordova-plugin-firebase Version 0.1.9
  • Visual Studio 2015 Apache Cordova Update 7
  • Cordova CLI Version 5.4.1
  • Cordova Android Version 4.1.1

Most helpful comment

I had <resource-file src="GoogleService-Info.plist" /> in my config.xml- removing that solved my problem since it causes cordova to write to the Resources-folder of the ios installation

All 11 comments

what other plugins are you using?

My Plugins:

  • com.lampa.startapp 0.1.4 "startApp"
  • com.phonegap.plugins.PushPlugin 2.4.0 "PushPlugin" (with android-support-v13.jar)
  • com.telerik.plugins.healthkit 0.4.2 "HealthKit"
  • cordova-plugin-camera 2.2.1-dev "Camera"
  • cordova-plugin-compat 1.0.0 "Compat"
  • cordova-plugin-customurlscheme 4.1.3 "Custom URL scheme"
  • cordova-plugin-device 1.1.2 "Device"
  • cordova-plugin-dialogs 1.2.0 "Notification"
  • cordova-plugin-file 4.1.1 "File"
  • cordova-plugin-file-transfer 1.5.1 "File Transfer"
  • cordova-plugin-firebase 0.1.9 "Google Firebase Plugin"
  • cordova-plugin-geolocation 2.1.0 "Geolocation"
  • cordova-plugin-inappbrowser 1.3.0 "InAppBrowser"
  • cordova-plugin-media 2.2.0 "Media"
  • cordova-plugin-splashscreen 4.0.0 "Splashscreen"
  • cordova-plugin-themeablebrowser 0.2.15 "ThemeableBrowser"
  • cordova-plugin-whitelist 1.2.1 "Whitelist"
  • cordova-plugin-x-socialsharing 5.1.1 "SocialSharing"
  • ionic-plugin-keyboard 2.2.0 "Keyboard"
  • phonegap-facebook-plugin 0.12.0 "Facebook Connect" (with android-support-v13.jar)

this plugin replaces PushPlugin so don't use both

I use this PushPlugin in both cordova iOS and Android platforms but I need to add firebase analytic to my app. I should remove pushPlugin and use push function from this firebase plugin instead. Is it right?

After I remove pushPlugin I got the same error message:

Installing plugin "cordova-plugin-firebase" following successful platform add of android
Found variables for "cordova-plugin-firebase". Processing as cli_variables.
Installing "cordova-plugin-firebase" for android
Running command: cmd "/s /c "(ProjectPath)\platforms\android\cordova\version.bat""
Command finished with error code 0: cmd /s /c "(ProjectPath)\platforms\android\cordova\version.bat"
Executing "before_plugin_install" hook for "cordova-plugin-firebase" on android.
Install start for "cordova-plugin-firebase" on android.
Beginning processing of action stack for android project...
MDAVSCLI : warning : Error during processing of action! Attempting to revert...
MDAVSCLI : warning : Failed to install 'cordova-plugin-firebase':Error Uh oh!
"(ProjectPath)\platforms\android\google-services.json" already exists!
at Object.module.exports.common.copyNewFile (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\src\plugman\platforms\common.js:67:19)
at module.exports.source-file.install (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\src\plugman\platforms\android.js:78:20)
at C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\src\platforms\PlatformApiPoly.js:654:27
at Object.ActionStack.process (C:\Users\Khomkrib\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\node_modules\cordova-common\src\ActionStack.js:56:25)
at PlatformApiPoly.addPlugin (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\src\platforms\PlatformApiPoly.js:259:20)
at handleInstall (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:603:6)
at C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:382:28
at _fulfilled (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.4.1\node_modules\cordova\node_modules\q\q.js:749:13)
MDAVSCLI : error : Uh oh!
"\platforms\android\google-services.json" already exists!
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

have you tried to make a clean build?

Yes, I made a clean build and remove project platforms before.

then one of the other plugins you use also write the google-services.json file, or you are writing it yourself. There can only be one file, which is why its failing. We could change the hook to just throw a warning but that won't fix the actual problem

This still happens whenever you remove and add a platform back, with the plugin previously installed.
I'm guessing that both the hook and and the dummy files from src (referenced by plugin.xml) are trying to be copied to the same location.

In my case, since my build process always recreates the platform, I removed <source-file src="src/android/google-services.json" target-dir="." /> and <resource-file src="src/ios/GoogleService-Info.plist" target="Resources/GoogleService-Info.plist" /> from plugin.xml. The hook still copies both files from the root folder of my project.

in your config.xml first install cordova-plugin-firebase then push plugin then this problem would be resolved. But make sure to first remove both plugins from plugins folder after removing platform

I had <resource-file src="GoogleService-Info.plist" /> in my config.xml- removing that solved my problem since it causes cordova to write to the Resources-folder of the ios installation

Was this page helpful?
0 / 5 - 0 ratings

Related issues

merbin2012 picture merbin2012  路  4Comments

michaelreiser picture michaelreiser  路  5Comments

dhavalsoni2001 picture dhavalsoni2001  路  5Comments

danielpalen picture danielpalen  路  5Comments

stephan-nordnes-eriksen picture stephan-nordnes-eriksen  路  5Comments