Cordova-plugin-firebasex: Unable to (re-)add android@latest platform

Created on 20 Jun 2019  路  16Comments  路  Source: dpa99c/cordova-plugin-firebasex

Describe the bug
I had to remove my android platform and I'm currently unable to re-add it. At least the 'cordova platform add android@latest` doesn't complete successfully.

This is the relevant part of my package.json:

  "dependencies": {
    "@angular/animations": "4.4.3",
    "@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/app-version": "4.7.0",
    "@ionic-native/camera": "3.9.2",
    "@ionic-native/contacts": "3.9.2",
    "@ionic-native/core": "3.9.2",
    "@ionic-native/email-composer": "4.5.3",
    "@ionic-native/facebook": "4.4.2",
    "@ionic-native/file": "3.9.2",
    "@ionic-native/firebase": "3.9.2",
    "@ionic-native/geolocation": "3.9.2",
    "@ionic-native/google-plus": "^4.20.0",
    "@ionic-native/in-app-purchase-2": "4.12.0",
    "@ionic-native/keyboard": "3.9.2",
    "@ionic-native/media": "^4.20.0",
    "@ionic-native/media-capture": "3.9.2",
    "@ionic-native/native-audio": "4.5.2",
    "@ionic-native/native-keyboard": "4.6.0",
    "@ionic-native/splash-screen": "3.9.2",
    "@ionic-native/status-bar": "3.9.2",
    "@ionic-native/toast": "^4.20.0",
    "@ionic/storage": "2.0.1",
    "android-versions": "1.3.0",
    "angularfire2": "5.0.0-rc.3",
    "animate.css": "3.6.1",
    "copyfiles": "2.0.0",
    "cordova-android": "8.0.0",
    "cordova-ios": "^4.5.5",
    "cordova-ios-plugin-no-export-compliance": "0.0.5",
    "cordova-plugin-androidx": "1.0.2",
    "cordova-plugin-androidx-adapter": "1.0.2",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-cocoapod-support": "git+https://github.com/dpa99c/cordova-plugin-cocoapods-support.git",
    "cordova-plugin-cocoapod-supportx": "git+https://github.com/dpa99c/cordova-plugin-cocoapods-support.git",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-contacts": "^2.3.1",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-disable-ios11-statusbar": "^1.0.0",
    "cordova-plugin-email-composer": "^0.8.15",
    "cordova-plugin-facebook4": "^2.1.0",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-firebase": "git+https://github.com/dpa99c/cordova-plugin-firebase.git",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-googleplus": "^7.0.0",
    "cordova-plugin-ionic-webview": "^4.0.1",
    "cordova-plugin-media": "5.0.2",
    "cordova-plugin-media-capture": "1.4.3",
    "cordova-plugin-native-keyboard": "^1.5.4",
    "cordova-plugin-nativeaudio": "^3.0.9",
    "cordova-plugin-purchase": "8.1.1",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-toast": "2.7.2",
    "css-animator": "2.3.1",
    "firebase": "4.5.0",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "moment": "2.18.1",
    "ng2-cordova-oauth": "0.0.8",
    "promise-polyfill": "^8.1.0",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "underscore": "1.9.1",
    "web-animations-js": "2.3.1",
    "zone.js": "0.8.10"
  },

Console Logs

Installing "cordova-plugin-firebase" for android
Failed to install 'cordova-plugin-firebase': Error: Expected plugin to have ID "cordova-plugin-cocoapod-support" but got "cordova-plugin-cocoapod-supportx".
    at checkID (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:203:15)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:187:9
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Expected plugin to have ID "cordova-plugin-cocoapod-support" but got "cordova-plugin-cocoapod-supportx".

Plugin Version

cordova-ios-plugin-no-export-compliance 0.0.5 "iOS No Export Compliance"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.0.2 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 2.3.1 "Contacts"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-disable-ios11-statusbar 1.0.0 "cordova-plugin-disable-ios11-statusbar"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-facebook4 2.1.0 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-firebase 2.0.5-custom "Google Firebase Plugin"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googleplus 7.0.0 "Google SignIn"
cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
cordova-plugin-media 5.0.2 "Media"
cordova-plugin-media-capture 1.4.3 "Capture"
cordova-plugin-native-keyboard 1.5.4 "Native Keyboard"
cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio"
cordova-plugin-purchase 8.1.1 "Purchase"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-toast 2.7.2 "Toast"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Any help would be really much appreciated! If I try to switch back to android 7.x, the build will fail as well (because of dependencies for this plugin, as mentioned here: https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862)

That comment was the reason to give your fork a try.

All 16 comments

remove these lines from config.xml and package.json:

    "cordova-plugin-firebase": "git+https://github.com/dpa99c/cordova-plugin-firebase.git",
    "cordova-plugin-cocoapod-support": "git+https://github.com/dpa99c/cordova-plugin-cocoapods-support.git",

than execute:

cordova plugin add cordova-plugin-firebasex

@dpa99c have changed the name of plugins, now they are distributed via NPM with different name, so you must update the name.

Removing cordova-plugin-firebase and cordova-plugin-cocoapod-support and adding cordova-plugin-firebasex should resolve this.
I'll update the documentation to make this clearer.

@dann95 and @dpa99c Thanks you for your support! First I ran the following:

 ~> cordova plugin rm cordova-plugin-firebase --force ; cordova plugin add cordova-plugin-firebasex
Plugin "cordova-plugin-firebase" is not present in the project. See `cordova plugin list`.
Installing "cordova-plugin-firebasex" for ios
Plugin dependency "[email protected]" already fetched, using that version.
Dependent plugin "cordova-plugin-cocoapod-supportx" already installed on ios.
Adding cordova-plugin-firebasex to package.json
Saved plugin info for "cordova-plugin-firebasex" to config.xml

That resolves in this dependencies:

  "dependencies": {
    "@angular/animations": "4.4.3",
    "@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/app-version": "4.7.0",
    "@ionic-native/camera": "3.9.2",
    "@ionic-native/contacts": "3.9.2",
    "@ionic-native/core": "3.9.2",
    "@ionic-native/email-composer": "4.5.3",
    "@ionic-native/facebook": "4.4.2",
    "@ionic-native/file": "3.9.2",
    "@ionic-native/firebase": "3.9.2",
    "@ionic-native/geolocation": "3.9.2",
    "@ionic-native/google-plus": "^4.20.0",
    "@ionic-native/in-app-purchase-2": "4.12.0",
    "@ionic-native/keyboard": "3.9.2",
    "@ionic-native/media": "^4.20.0",
    "@ionic-native/media-capture": "3.9.2",
    "@ionic-native/native-audio": "4.5.2",
    "@ionic-native/native-keyboard": "4.6.0",
    "@ionic-native/splash-screen": "3.9.2",
    "@ionic-native/status-bar": "3.9.2",
    "@ionic-native/toast": "^4.20.0",
    "@ionic/storage": "2.0.1",
    "android-versions": "1.3.0",
    "angularfire2": "5.0.0-rc.3",
    "animate.css": "3.6.1",
    "copyfiles": "2.0.0",
    "cordova-ios": "^4.5.5",
    "cordova-ios-plugin-no-export-compliance": "0.0.5",
    "cordova-plugin-androidx": "1.0.2",
    "cordova-plugin-androidx-adapter": "1.0.2",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-cocoapod-supportx": "git+https://github.com/dpa99c/cordova-plugin-cocoapods-support.git",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-contacts": "^2.3.1",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-disable-ios11-statusbar": "^1.0.0",
    "cordova-plugin-email-composer": "^0.8.15",
    "cordova-plugin-facebook4": "^2.1.0",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-googleplus": "^7.0.0",
    "cordova-plugin-ionic-webview": "^4.0.1",
    "cordova-plugin-media": "5.0.2",
    "cordova-plugin-media-capture": "^3.0.2",
    "cordova-plugin-nativeaudio": "^3.0.9",
    "cordova-plugin-purchase": "8.1.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-toast": "2.7.2",
    "css-animator": "2.3.1",
    "firebase": "4.5.0",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "moment": "2.18.1",
    "ng2-cordova-oauth": "0.0.8",
    "promise-polyfill": "^8.1.0",
    "rxjs": "5.4.3",
    "shelljs": "^0.8.3",
    "sw-toolbox": "3.6.0",
    "underscore": "1.9.1",
    "web-animations-js": "2.3.1",
    "zone.js": "0.8.10"
  },

And this corresponding entry in the config.xml:
<plugin name="cordova-plugin-firebasex" spec="~2.0.6" />

But somethings seems to be broken. As soon as I try to remove another plugin (to update it), this error occurs:

~> cordova plugin rm cordova-plugin-native-keyboard  --force
Cannot find plugin.xml for plugin "cordova-plugin-firebase". Please try adding it again.

Looks like the renaming didn't work as expected? I also wonder if the ionic-native wrapper (@ionic-native/firebase": "3.9.2") is working with the renamed package?

Some system information:

Ionic:

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

Cordova:

   Cordova CLI       : 8.1.2 ([email protected])
   Cordova Platforms : ios 4.5.5
   Cordova Plugins   : cordova-plugin-ionic-webview 4.0.1, (and 24 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : 0.2.5

System:

   Android SDK Tools : 26.1.1 (/Users/svzi/Library/Android/sdk)
   ios-deploy        : 1.9.2
   NodeJS            : v8.11.3 (/usr/local/bin/node)
   npm               : 5.6.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001
````
Platform android is missing, because I can't add it... 

Installed cordova plugins now:

~> cordova plugin list
cordova-ios-plugin-no-export-compliance 0.0.5 "iOS No Export Compliance"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.0.2 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 2.3.1 "Contacts"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-disable-ios11-statusbar 1.0.0 "cordova-plugin-disable-ios11-statusbar"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-facebook4 2.1.0 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-firebasex 2.0.6 "Google Firebase Plugin"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googleplus 7.0.0 "Google SignIn"
cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
cordova-plugin-media 5.0.2 "Media"
cordova-plugin-media-capture 3.0.2 "Capture"
cordova-plugin-native-keyboard 1.5.4 "Native Keyboard"
cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio"
cordova-plugin-purchase 8.1.1 "Purchase"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-toast 2.7.2 "Toast"
ionic-plugin-keyboard 2.2.1 "Keyboard"
```

@svzi looks like a reference to cordova-plugin-firebase is stuck somewhere in your project:
check in package.json, config.xml, plugins/, plugins/fetch.json, node_modules/

@dpa99c Thanks, I found it in the plugins/fetch.json and removed it. After that I deleted the node_modules folder, but that didn't change anything. I'm still unable to remove another plugin or add the android platform back. Still the same error messages as shown before. :-(

I would get drastic then:

rm -Rf node_modules plugins platforms
npm install
cordova platform add android@latest

@dpa99c Yay I can build again!

Sadly my app instantly crashes on startup. This is a dump from logcat:

   FirebaseInitProvider  I  FirebaseApp initialization successful
        CrashlyticsCore  I  Initializing Crashlytics 2.6.7.30
CrashlyticsInitProvider  I  CrashlyticsInitProvider initialization successful
                     FA  I  App measurement is starting up, version: 16250
                         I  To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
                         I  To enable faster debug mode event logging run:
                         I    adb shell setprop debug.firebase.analytics.app de.xxx
         AndroidRuntime  D  Shutting down VM
  NetworkSecurityConfig  D  No Network Security Config specified, using platform default
         AndroidRuntime  E  FATAL EXCEPTION: main
                         E  Process: de.xxx, PID: 22809
                         E  java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider:
                            java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider
                            " on path: DexPathList[[zip file "/data/app/de.xxx-mt4JARs2hX1NKTJbyOt1r
                            g==/base.apk"],nativeLibraryDirectories=[/data/app/de.xxx-mt4JARs2hX1NKT
                            JbyOt1rg==/lib/arm64, /system/lib64, /product/lib64]]
                         E      at android.app.ActivityThread.installProvider(ActivityThread.java:7123)
                         E      at android.app.ActivityThread.installContentProviders(ActivityThread.java:6655)
                         E      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6548)
                         E      at android.app.ActivityThread.access$1900(ActivityThread.java:267)
                         E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1963)
                         E      at android.os.Handler.dispatchMessage(Handler.java:109)
                         E      at android.os.Looper.loop(Looper.java:207)
                         E      at android.app.ActivityThread.main(ActivityThread.java:7470)
                         E      at java.lang.reflect.Method.invoke(Native Method)
                         E      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
                         E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
                         E  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.F
                            ileProvider" on path: DexPathList[[zip file "/data/app/de.xxx-mt4JARs2hX
                            1NKTJbyOt1rg==/base.apk"],nativeLibraryDirectories=[/data/app/de.xxx-mt4
                            JARs2hX1NKTJbyOt1rg==/lib/arm64, /system/lib64, /product/lib64]]
                         E      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
                         E      at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                         E      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                         E      at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
                         E      at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:
                            62)
                         E      at android.app.ActivityThread.installProvider(ActivityThread.java:7107)
                         E      ... 10 more
                         E  [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
        CrashlyticsCore  E  Failed to execute task.
                         E  java.util.concurrent.TimeoutException
                         E      at java.util.concurrent.FutureTask.get(FutureTask.java:206)
                         E      at com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(CrashlyticsBac
                            kgroundWorker.java:41)
                         E      at com.crashlytics.android.core.CrashlyticsController.handleUncaughtException(Crashlytic
                            sController.java:321)
                         E      at com.crashlytics.android.core.CrashlyticsController$6.onUncaughtException(CrashlyticsC
                            ontroller.java:301)
                         E      at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(Cr
                            ashlyticsUncaughtExceptionHandler.java:42)
                         E      at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
                         E      at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
                         E      at java.lang.Thread.dispatchUncaughtException(Thread.java:1975)
                Process  I  Sending signal. PID: 22809 SIG: 9

always when removing plugins, do:

rm -rf platforms/ plugins/ node_modules/
cordova plugin remove name-of-plugin

than also check on config.xml and package.json to be sure.

About your instant crash, i'm not home now to be able to check, any news about it?

@dpa99c yeah, we need to write better instructions to ppl who wants to use this plugin.

@dann95 No news about that crash. I can build for iOS and run it on my device. I can even build, sign and upload to App Store Connect. But Android seems to be a mess. No matter what I tried so far.

I admit that I also tried https://github.com/wizpanda/cordova-plugin-firebase-lib, but without luck. I didn't even get this far. But looking at the issues at the aforementioned plugin, I felt way better supported here with you guys, so I switched back and tried everything I could... But that seems to be not enough. :-(

@svzi I've just published [email protected] to npm which also migrates references in project.properties and AndroidManifest.xml - please give it a try as it should resolve the runtime crash above.

@dpa99c Man, you're awesome! I'm finally able to run my app again! Thanks a lot, I really appreciate your outstanding effort and support. 馃憤

FYI just published [email protected] which adds some more improvements - see the changelog for details

Just upgraded, thanks again! Please keep up the great work! To show you my appreciation, and to support further development, I just donated a few bucks. 馃憤

Oops 馃槵
Thanks Sven!

Was this page helpful?
0 / 5 - 0 ratings