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:
what other plugins are you using?
My Plugins:
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
at module.exports.source-file.install (C:\Users
at C:\Users
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
at handleInstall (C:\Users
at C:\Users
at _fulfilled (C:\Users
at self.promiseDispatch.done (C:\Users
at Promise.promise.promiseDispatch (C:\Users
MDAVSCLI : error : Uh oh!
"
========== 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
Most helpful comment
I had
<resource-file src="GoogleService-Info.plist" />inmy config.xml- removing that solved my problem since it causes cordova to write to the Resources-folder of the ios installation