# Notification plugin crash

**URL:** <https://forum.ionicframework.com/t/notification-plugin-crash/188447>\
**Category:** Capacitor\
**Created:** [April 29, 2020, 9:28pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447 "2020-04-29T21:28:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![florent-movework](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@florent-movework](https://forum.ionicframework.com/u/florent-movework)\
**Post date:** [April 29, 2020, 9:28pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/1 "2020-04-29T21:28:09Z")

</div>

Hello,

I’m trying to make a new app using capacitor, and i get a crash when trying to use notification plugins.

I followed the guideline [here](https://capacitor.ionicframework.com/docs/guides/push-notifications-firebase/).

Running PushNotifications.register() makes app crash, and i get this error message in Android studio console:

Default FirebaseApp is not initialized in this process my.pack.name . Make sure to call FirebaseApp.initializeApp(Context) first.

Here is my config:

Ionic:

Ionic CLI : 6.6.0 (/home/florent/.nvm/versions/node/v12.14.0/lib/node\_modules/@ionic/cli)  
Ionic Framework : @ionic/angular 5.0.7  
@angular-devkit/build-angular : 0.803.26  
@angular-devkit/schematics : 8.3.26  
@angular/cli : 8.3.26  
@ionic/angular-toolkit : 2.2.0

Capacitor:

Capacitor CLI : 2.0.2  
@capacitor/core : 2.0.2

Utility:

cordova-res (update available: 0.13.1) : 0.12.1  
native-run : 1.0.0

System:

NodeJS : v12.14.0 (/home/florent/.nvm/versions/node/v12.14.0/bin/node)  
npm : 6.13.4  
OS : Linux 4.15

I would appreciate a lot any help on understanding what’s happening here !

---

<div class="post-metadata">

**Author:** ![florent-movework](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@florent-movework](https://forum.ionicframework.com/u/florent-movework)\
**Post date:** [April 30, 2020, 12:47pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/2 "2020-04-30T12:47:58Z")

</div>

Ok I found my mistake, the google-service.json was just not in the right directory android/app.

---

<div class="post-metadata">

**Author:** ![aardra](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@aardra](https://forum.ionicframework.com/u/aardra)\
**Post date:** [May 23, 2020, 3:56pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/3 "2020-05-23T15:56:06Z")

</div>

Hi

I am getting the same error message. I have placed the goggle-sevice.json file in android/app as well. But still getting the same crash.

Do i simple do a sync or build in capacitor before Anrdroid studio. How to make sure goggle-sevice.json is being passed into Andriod Studio.

---

<div class="post-metadata">

**Author:** ![nikkothari22](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@nikkothari22](https://forum.ionicframework.com/u/nikkothari22)\
**Post date:** [May 15, 2021, 6:12am UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/4 "2021-05-15T06:12:06Z")

</div>

Hi,

Were you able to solve the issue? I’m facing the same issue, and my Google-services.JSON file is in the correct directory.

The error is thrown while calling the .register() method. And the error is only on the Android platform.

Thank you!

---

<div class="post-metadata">

**Author:** ![PierreNansot](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@PierreNansot](https://forum.ionicframework.com/u/PierreNansot)\
**Post date:** [May 15, 2021, 7:58am UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/5 "2021-05-15T07:58:05Z")

</div>

i proposed a fix

> <https://github.com/ionic-team/capacitor-plugins/pull/395>
>
> PushNotifications.register() fail with com.google.firebase:firebase-messaging \>… 21.0.0 or com.google.firebase:firebase-bom \> 28.0.0
> 
> See https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId
> 
> With fresh setup using @capacitor v3 and current version of firebase, it's essential to update this plugin.
> Otherwise, it's useless and crash the app.

---

<div class="post-metadata">

**Author:** ![nikkothari22](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@nikkothari22](https://forum.ionicframework.com/u/nikkothari22)\
**Post date:** [May 30, 2021, 12:34pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/6 "2021-05-30T12:34:39Z")

</div>

The issue was fixed after I migrated to Capacitor v3 - the older plug-in was using a deprecated method.

---

<div class="post-metadata">

**Author:** ![ayubIonicpro](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@ayubIonicpro](https://forum.ionicframework.com/u/ayubIonicpro)\
**Post date:** [May 31, 2021, 6:03pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/7 "2021-05-31T18:03:43Z")

</div>

How to migrate to v3 can you help me out ?

---

<div class="post-metadata">

**Author:** ![nikkothari22](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@nikkothari22](https://forum.ionicframework.com/u/nikkothari22)\
**Post date:** [May 31, 2021, 8:07pm UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/8 "2021-05-31T20:07:49Z")

</div>

You can check the documentation here: [Capacitor - build cross platform apps with the web](https://capacitorjs.com/docs/updating/3-0)

It depends on whether the community plugins you currently use support Capacitor v3 or not, so you would have to check that for every individual plugin.

All the official plugins support Capacitor v3 though.

Let me know how it goes 🙂

---

<div class="post-metadata">

**Author:** ![petermash](https://avatars.discourse-cdn.com/v4/letter/p/51bf81/32.png) [@petermash](https://forum.ionicframework.com/u/petermash)\
**Post date:** [July 29, 2022, 10:14am UTC](https://forum.ionicframework.com/t/notification-plugin-crash/188447/9 "2022-07-29T10:14:57Z")

</div>

Copy the google-servives.json file to android/app and try again.
