pusher / push-notifications-android

Android SDK for Pusher Beams
https://www.pusher.com/beams
MIT License
21 stars 21 forks source link

Migrate library to use "Firebase Installations" instead of the now deprecated "Instance ID" #117

Closed julioromano closed 3 months ago

julioromano commented 3 years ago

When using push-notifications-android 1.6.2 with Firebase Cloud Messaging 22.0.0 the library crashes at runtime with:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId; at com.pusher.pushnotifications.PushNotificationsInstance.start(PushNotificationsInstance.kt:180) at com.pusher.pushnotifications.PushNotifications.start(PushNotifications.java:31)

This is because the Instance ID has been removed from Firebase: https://firebase.google.com/support/release-notes/android#messaging_v22-0-0

The Pusher library must be migrated to make use of Firebase Installations instead of Instance IDs as per: https://firebase.google.com/docs/projects/manage-installations#fid-iid

P.S. A temporary workaround is to explicitly include the firebase-iid library as a direct dependency.

willc0de4food commented 3 years ago

I'm running into this issue as well, and my app is crashing when I try to register for push notifications. ~~@julioromano can you add a link or reference to the firebase-iid library that you mentioned? I see it is also mentioned in the release notes, but I'm not sure what the implementation would be.~~ Edit: for anyone else looking, the current version of firebase-iid is 21.1.0, so you can add the following to your app-level build.gradle implementation 'com.google.firebase:firebase-iid:21.1.0'

Edijae commented 3 years ago

adding firebase bom to the app gradle fileimplementation platform('com.google.firebase:firebase-bom:28.0.1')(latest version of bom as per this writting was 28.0.1) and you don't have to remember the version of any other firebase library.

    implementation platform('com.google.firebase:firebase-bom:28.0.1')
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-iid'
julioromano commented 1 year ago

@deeborania firebase-iid has been removed in firebase bom 31.0.0: https://firebase.google.com/support/release-notes/android#2022-10-12

This library now effectively blocks any upgrades to firebase bom 31.0.0 and above.

Migration to firebase installations is now a priority.

julioromano commented 1 year ago

@benjamin-tang-pusher perhaps you can help with prioritizing this task?

julioromano commented 1 year ago

@MeenaAlfons can you help?

benjamin-tang-pusher commented 1 year ago

I noticed as a workaround for now, you can still add implementation 'implementation 'com.google.firebase:firebase-iid:21.1.0'' and the project will still build.

implementation 'com.pusher:push-notifications-android:1.9.0' implementation 'com.google.firebase:firebase-iid:21.1.0' implementation platform('com.google.firebase:firebase-bom:31.0.2') implementation 'com.google.firebase:firebase-messaging'

It's not ideal, but until this prioritised by our engineering, this will still fill in the missing dependency for anyone using firebase-bom:31.0.2

julioromano commented 1 year ago

Tested and indeed the workaround still works. Thanks. Needless to say we can't know if/when Google will completely disable firebase-iid:21.1.0, so a migration to firebase installations should be put in the roadmap.

Oleur commented 1 year ago

Any ETA defined for this fix or not yet? Thanks 😃

benjamin-tang-pusher commented 1 year ago

We have a fix here https://github.com/pusher/push-notifications-android/issues/117 but configuring gradle to use a local dependency instead of maven central is very complicated, and I'm still trying to test it.

julioromano commented 1 year ago

It seems the fix got released as 1.9.1 but upgrading to that version makes push notifications to stop from working.

sebj commented 1 year ago

+1, seeing the same issue as mentioned above. Updating to 1.9.1 and removing our explicit dependency on firebase-iid results in no push notifications being delivered.

VinuPolly-Bonnet commented 1 year ago

@julioromano @sebj hey guys should we also include com.google.firebase:firebase-core in addition to firebase-iid:21.1.0 when downgrading to 1.9.0 from 1.9.1 for the notifications to work?

makirby commented 1 year ago

Any updates on fixing this issue?

bqfa commented 11 months ago

image

Any Update ? I'm still getting this issue

image image

adriaan commented 10 months ago

+1, this has caused me considerable headaches over the past few days.

I needed to upgrade my Capacitor project to be able to target Android 13 / API level 33 (Play Store requirement from 1 September) Capacitor 5 requires a version of firebase that no longer includes firebase-iid.

It took considerable effort and frustration to find a dependency configuration to satisfy both Capacitor and Pusher.