react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.sutitaskmanager. Make sure to call FirebaseApp.initializeApp(Context) first.

Open sourabhchotia opened this issue 7 years ago • 11 comments

On Testing Notification Message From Google Firebase

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.sutitaskmanager. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.1.0:245) at com.google.firebase.messaging.MessagingAnalytics.zza(Unknown Source:68) at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(Unknown Source:2) at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:50) at com.google.firebase.iid.zzb.run(Unknown Source:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6) at java.lang.Thread.run(Thread.java:764)

sourabhchotia avatar Jul 16 '19 12:07 sourabhchotia

@zo0r I have Tested this a several time and got to know that this problem only occurs when app is open,

if it close the notification is working fine. but when the app is open it crashes as soon as the notification is received

Provide a solution for this

sourabhchotia avatar Jul 17 '19 04:07 sourabhchotia

Im getting the exact same problem as @sourabhchotia.

React version: 16.8.6 React-native version: 0.60.3 React-native-push-notifications version: ^3.1.3

Java exception 2019-07-18 09:29:57.939 15118-15176/com.mcspoc E/AndroidRuntime: FATAL EXCEPTION: Firebase-FirebaseMessagingService Process: com.mcspoc, PID: 15118 java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mcspoc. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@17.1.0:186) at com.google.firebase.messaging.MessagingAnalytics.zza(com.google.firebase:firebase-messaging@@19.0.1:75) at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@19.0.1:2) at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@19.0.1:50) at com.google.firebase.messaging.zzg.run(com.google.firebase:firebase-messaging@@19.0.1:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6) at java.lang.Thread.run(Thread.java:764)

This issue occurred on both the emulator and a physical device Physical device: Samsung Galaxy S8 running Android 8.0 Emulator: running Android 9.0

Would be great to see this fixed, as it's very possible to receive remote notifications while using the app in general.

nicky-ernste avatar Jul 18 '19 07:07 nicky-ernste

Getting the same issue. App crashes on receiving a notification. Any update on this?

07-19 10:47:46.823 15914-16049/com.deeplinks E/AndroidRuntime: FATAL EXCEPTION: Firebase-RNPushNotificationListenerService Process: com.deeplinks, PID: 15914 java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.deeplinks. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@17.1.0:186) at com.google.firebase.messaging.MessagingAnalytics.zza(com.google.firebase:firebase-messaging@@19.0.1:75) at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@19.0.1:2) at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@19.0.1:50) at com.google.firebase.messaging.zzg.run(com.google.firebase:firebase-messaging@@19.0.1:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source) at java.lang.Thread.run(Thread.java:818)

KPS250 avatar Jul 19 '19 05:07 KPS250

I can confirm the same issue.

After playing a bit with push notification payload, seems like having "notification": {"body": "message"} is causing v3.1.3 to crash with that error.

Removing notification.body ^ and having title and message attrs in the root of payload is working fine with v3.1.3, but is crashing v3.0.1 that we currently use, so that way we would break existing installs of the app in production.

vdragsic avatar Jul 22 '19 15:07 vdragsic

Is anyone who resolved this problem? I face the same:

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process ua.vo_app_cabinet. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@17.1.0:186) at com.google.firebase.messaging.MessagingAnalytics.zza(com.google.firebase:firebase-messaging@@19.0.1:75) at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@19.0.1:2) at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@19.0.1:50) at com.google.firebase.messaging.zzg.run(com.google.firebase:firebase-messaging@@19.0.1:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source) at java.lang.Thread.run(Thread.java:760)

RomanKontsevoy avatar Jul 26 '19 13:07 RomanKontsevoy

Try removing the GCM config from the manifest if you are using Firebase. Hope it helps.

    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="${applicationId}" />
        </intent-filter>
    </receiver>
    <!-- < Only if you're using GCM or localNotificationSchedule() > -->

KPS250 avatar Jul 26 '19 13:07 KPS250

GcmReceiver

Thank you for immediate answer, but nothing changed. In my project I can not find any code where Firebase App is mentioned. Maybe I did not add something?

RomanKontsevoy avatar Jul 26 '19 15:07 RomanKontsevoy

Same error . Somebody please help

muhammadashfaq avatar Jul 28 '19 02:07 muhammadashfaq

Same error . Somebody please help

This solution helped for me https://github.com/wix/react-native-notifications/issues/285#issuecomment-459178520

Natkarock avatar Aug 21 '19 13:08 Natkarock

try this

README /**

  • (optional) default: true
    • Specified if permissions (ios) and token (android and ios) will requested or not,
    • if not, you must call PushNotificationsHandler.requestPermissions() later
    • if you are not using remote notification or do not have Firebase installed, use this:
  • requestPermissions: Platform.OS === 'ios'
    

*/ requestPermissions: true,

QAZDER avatar May 11 '20 08:05 QAZDER

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 12 '21 00:05 github-actions[bot]