pusher / push-notifications-android

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

Incompatibility with com.google.firebase:firebase-messaging:17.6.0 #75

Closed mike-burns closed 5 years ago

mike-burns commented 5 years ago

Upgrading the dependency to com.google.firebase:firebase-messaging:17.6.0 and then sending any Firebase message, including a test one from the Firebase console, causes an app crash:

04-24 20:24:55.208 23623-23675/com.xxx.yyy E/AndroidRuntime: FATAL EXCEPTION: Firebase-WrappedFirebaseMessagingService
    Process: com.xxx.yyy, PID: 23623
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
        at android.content.ContextWrapper.getPackageName(ContextWrapper.java:133)
        at com.google.firebase.messaging.zzb.<init>(Unknown Source)
        at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source)
        at com.google.firebase.iid.zzb.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:818)

I tried it with just adding the com.pusher:push-notifications-android:1.4.0 dependency and then also adding the PushNotifications.start and .addDeviceInterest to MainActivity. Same result.

Removing the push-notifications-android dependency caused it to no longer crash. Downgrading firebase-messaging back to 17.5.0 also fixes it.

This set of deps works:

classpath 'com.google.gms:google-services:4.2.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
implementation 'com.pusher:push-notifications-android:1.4.0'

This set crashes on any Firebase message:

classpath 'com.google.gms:google-services:4.2.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.6.0' // the only change
implementation 'com.pusher:push-notifications-android:1.4.0'
mikebridge commented 5 years ago

I have this issue---reverting from 17.6.0 to 17.5.0 fixed it for me too.

ioanalaura12 commented 5 years ago

I had the same issue, same stack trace. Downgraded to 17.5.0 and everything is ok now.

daniellevass commented 5 years ago

Thanks for reporting! We've now fixed this issue in the most recent update 1.4.1 :-)