17

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

i have tried with many things but i am not able to Get notifications in devices.

i also tried with below thing.

In the Properties pane, set the Build Action Select google-services.json in the Solution Explorer window.

In the Properties pane, set the Build Action to GoogleServicesJson (if the GoogleServicesJson build action is not shown, save and close the Solution, then reopen it):to GoogleServicesJson

Notification was working before, but after I update the xamarin forms to 2.5.0.280555 and Xamarin.Firebase.Messaging.42.1021.1, it stopped working .

User2 Samcom
  • 173
  • 1
  • 1
  • 5

6 Answers6

33

For me, none of the solutions worked that were given anywhere. Only this worked. Just had to downgrade my google services from 4.1.0 to 4.0.0

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
    classpath 'com.google.gms:google-services:4.0.0'
    /*classpath 'com.google.gms:google-services:4.1.0' <-- this was the problem */
}

So if you have updated the google services, just try to downgrade or change to an older version. Hope it helps

Rohan Pawar
  • 1,875
  • 22
  • 40
Ammar Bukhari
  • 2,082
  • 2
  • 16
  • 16
24

Make sure:

  1. Package name in AndroidManifest.xml is identical to one in the google-services.json
  2. google-services.json build action is set to GoogleServicesJson
  3. After step 2 restart your IDE & clean & rebuild
  4. Explicitly call FirebaseApp.InitializeApp(Application.Context); in MainActivity.OnCreate just before the LoadApplication(..)
EvZ
  • 11,889
  • 4
  • 38
  • 76
24

Add the plugin to the build.gradle (app level)

// ADD THIS AT THE BOTTOM

apply plugin: 'com.google.gms.google-services'
Dan Alboteanu
  • 9,404
  • 1
  • 52
  • 40
  • I was able to run my app with Firebase just fine but after force closing and restarting I was getting this crash. Adding the apply plugin at the bottom of my build.gradle fixed the crash. – FSUWX2011 Mar 29 '19 at 13:51
3

for me, that happen when I forgot add the second plugin in the app module

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'  // Google Services plugin

after add this plug in, you can try the other's suggestions.

0

Upgrade com.google.gms:google-services to latest version, it will be solved.

Mohammed mansoor
  • 743
  • 3
  • 11
  • 18
0

Upgrade

com.google.gms:google-services

to latest version, it will be solved.

It works for me.