question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initialization problem on Android with version > 2.3.6

See original GitHub issue

I have an Xamarin Forms app with version 2.3.6 of the plugin and try to update to a more recent version.

On iOS, no problems but on Android, I tried many versions and I always get this error during FirebasePushNotificationManager.Initialize(this, true, createDefaultNotificationChannel:false)

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

My google-services.json file and package names are OK.

Here is my MainApplication init code, CreateNotificationChannels() create notifications channels if required.

Is there something in newer version that may require some code change ?

    public override void OnCreate() {
        base.OnCreate();

    if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O) {
            CreateNotificationChannels();
        }
        CrossFirebasePushNotification.Current.OnNotificationError += (object source, FirebasePushNotificationErrorEventArgs e) => {
            Console.WriteLine("OnNotificationError " + e.Message);
        };
        EchoMessager.Sync.Server.GetInstance().SetNotificationToken(CrossFirebasePushNotification.Current.Token);
        CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) => {
            EchoMessager.Sync.Server.GetInstance().SetNotificationToken(p.Token);
            Server.GetInstance().RegisterDevice();
        };

        CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => {
            EchoMessager.Sync.Server.GetInstance().ProcessNotification(p.Data);
        };

#if DEBUG
        FirebasePushNotificationManager.Initialize(this, true, createDefaultNotificationChannel:false);
#else
        FirebasePushNotificationManager.Initialize(this,false, createDefaultNotificationChannel:false);
#endif
    }

Bug Information

Version Number of Plugin: >2.3.6 Device Tested On: Simulator Tested On: multiple (API level Version of VS: Mac 8.4.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

16reactions
Haza85commented, Jan 28, 2020

I have add Xamarin.Firebase.Common package directly to Android project and it’s work now. Don’t forget to clean Anndoid project (manually delete bin and obj folders) and rebuild.

0reactions
ivandharocommented, May 23, 2020

I have add Xamarin.Firebase.Common package directly to Android project and it’s work now. Don’t forget to clean Anndoid project (manually delete bin and obj folders) and rebuild.

Thanks for the solution bro!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Source: Repo not displaying any initialization ...
Ok, now that I've installed Python 2.7, I get the same exact error message. I'll update my OP with the message. – user766650....
Read more >
Odin got stuck at initialization step - XDA Forums
Hi, I am a newbie and follow steps carefully to flash rom on my droid charge. I am using Odin 1.82 and...
Read more >
How to Solve "Failure to initialize" Error on Android Emulator
The "Failure to initialize" error may be caused by the incompatibility between the Android emulator and your out-of-date AMD CPU.
Read more >
[Q] WhatsApp was Unable to complete initialization
Unable to initializie whatsapp! Any expert with any solution? What I find in my settings is the following: Android Version 2.3.6. Baseband ...
Read more >
Update problem from 2.3.4 to 2.3.6
Hey guyz.....i tried updating my ace from 2.3.4 which is my original firmware..to 2.3.6 through phone's software update.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found