2
votes

I just created a new ionic project and tried to integrate firebase native with it, its not working. Can someone please help me with this.

C:\Users\goura\Desktop\Ioninc\test>ionic cordova plugin add cordova-plugin-firebase
> cordova.cmd plugin add cordova-plugin-firebase
Installing "cordova-plugin-firebase" for android
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-firebase': Error: Uh oh!
EPERM: operation not permitted, unlink 'C:\Users\goura\Desktop\Ioninc\test\platforms\android\app\src\main'
    at Object.unlinkSync (fs.js:1136:3)
    at mayCopyFile (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:59:8)
    at onFile (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:54:10)
    at getStats (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:48:44)
    at startCopy (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:38:10)
    at handleFilterAndCopy (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:33:10)
    at Object.copySync (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:26:10)
    at copyFile (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\lib\pluginHandlers.js:223:12)
    at install (C:\Users\goura\Desktop\Ioninc\test\platforms\android\cordova\lib\pluginHandlers.js:61:13)

Versions of installations node - v12.18.3 npm - 6.14.6 ionic - 5.4.16 cordova - 10.0.0 @ionic-native/firebase - 5.28.0 cordova-plugin-firebase - 2.0.5

Gradle - 7 Java - 8.1

I tried FCM as well it was giving some annotations error.

1
I have the same error only with the platform android 9.0.0 version. With lower android version firebase install without errors.Sergey Oleynikov
There is cordova-plugin-firebasex for [email protected]Sergey Oleynikov

1 Answers

0
votes

I had the same issue. The only solution i've found was create another project and add plugin before adding android platform.

Another possible solution (i haven't test yet) is, in original project, include this line in config.xml:

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

or runing in terminal:

cordova plugin add cordova-plugin-firebase --save

and then rebuild your apk. Source: https://www.npmjs.com/package/cordova-plugin-firebase
(plugin official support)

Let me know if works.

UPDATE

I've test the second option (include <plugin name="cordova-plugin-firebase" spec="^2.0.0" /> in config.xml) and it works for me. Just remember rebuild your apk after.