chemerisuk / cordova-plugin-firebase-messaging

Cordova plugin for Firebase Cloud Messaging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking changes with Capacitor 4.0 and Ionic 6

iamromec opened this issue · comments

Hello,

I'm trying to migrate my old app with Ionic 6. Everything is fine but when I install this plugin, the Android build fails with the following exception:

Screenshot 2022-08-04 at 6 06 58 PM

Here is my package.json file

Screenshot 2022-08-04 at 6 08 14 PM

If I remove the plugin and rebuild it, it works fine. So I assume there are some issues with the plugin or compatibility with the latest capacitor version.

Please help. And let me know if you need more info.

@iamromec it looks like capacitor doesn’t support bom dependencies yet ionic-team/capacitor#5820 (comment).

Even if I downgrade to 6.1.0, it breaks and throws the following error on app launch.

"java.lang.RuntimeException: Cordova method createChannel does not have valid parameters"

Screenshot 2022-08-05 at 6 01 21 PM

FYI, I have tried adding all firebase plugins to get deviceToekn like firebase, firebase x, and firebase messaging. But all of these are incompatible with Capacitor 4.0.

@iamromec try to downgrade Cordova-support-android-plugin too. The error you mentioned is connected to its latest version but previous Cordova firebase plugins should use version 1.

It worked after downgrading to cordova-support-android-plugin: ^1.0.2.

Additionally, I had to do the following things in order to make it work:

  • Add android:exported="false" to /android/app/src/main/AndroidManifest.xml on activity tag

  • Add android:exported="false" to /android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml on receiver and sender tags

  • Then I had to go to Android Studio > Refractor > Migrate to AndroidX

And then run the app. If these could be automated for Capacitor 4.0, it'd work smoothly.

Note: These changes are in general for Capacitor 4 and Ionic 6. Not to do anything with this plugin.

Downgrading to 6.1.0 worked fine in Android after downgrading the support plugin as well.

But it throws errors in iOS (Xcode) while building with the latest capacitor 4.0.

Please please make this plugin work for both platforms smoothly. It's really frustrating to upgrade/downgrade for iOS/Android to build or run the app.

@iamromec it's primary a Cordova Plugin. Ask iconic/capacitor related questions on their forum.