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

Failing to add plugin in Ionic3 Android8 #1108

Open lqrz opened 4 years ago

lqrz commented 4 years ago

Describe the bug I'm using Ionic v3 and with an Android engine 8.0.0, and when I try to install this plugin it fails with the following error:

> cordova plugin add cordova-plugin-firebase --save

You have been opted out of telemetry. To change this, run: cordova telemetry on.
Installing "cordova-plugin-firebase" for android

Failed to install 'cordova-plugin-firebase': Error: ENOENT: no such file or directory, open '.../platforms/android/app/src/main/AndroidManifest.xml'
    at Object.openSync (fs.js:439:3)
    at Object.readFileSync (fs.js:344:35)
    at Object.parseElementtreeSync (.../node_modules/cordova-common/src/util/xml-helpers.js:181:36)
    at new AndroidManifest (.../platforms/android/cordova/lib/AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (.../platforms/android/cordova/lib/AndroidProject.js:92:12)
    at Api.addPlugin (.../platforms/android/cordova/Api.js:208:57)
    at handleInstall (.../node_modules/cordova-lib/src/plugman/install.js:581:10)
    at .../node_modules/cordova-lib/src/plugman/install.js:349:28
    at process._tickCallback (internal/process/next_tick.js:68:7)

ENOENT: no such file or directory, open '.../platforms/android/app/src/main/AndroidManifest.xml'

My ionic info:

cli packages: (.../node/v10.15.1/lib/node_modules)

    @ionic/cli-utils  : 1.19.3
    ionic (Ionic CLI) : 3.20.1

global packages:

    cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1) 

local packages:

    @ionic/app-scripts : 3.2.1
    Cordova Platforms  : android 8.0.0 browser 6.0.0 ios 5.0.1
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.4 
    ios-sim           : 8.0.1 
    Node              : v10.15.1
    npm               : 6.4.1 
    OS                : macOS
    Xcode             : Xcode 10.3 Build version 10G8 

Environment Variables:

    ANDROID_HOME : .../Library/Android/sdk/

Misc:

    backend : pro
harveylx commented 4 years ago

I think this may be a bug within the plugin itself. It seems like it sometimes removes the AndroidManifest file for some reason, try removing the android platform first

ionic cordova platform remove android

then

ionic cordova platform add android

Then try adding the plugin