Push - failed to register - firebase already register [SOLVED]

Hi,

can’t make push notification working.

Android Error : E/push: Failed to register java.lang.IllegalStateException: FirebaseApp name [DEFAULT] already exists! at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29) at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.0.2:350) at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.0.2:324) at com.defold.push.Push.registerFirebase(Push.java:348) at com.defold.push.Push.startFirebase(Push.java:378) at com.defold.push.Push.access$200(Push.java:54) at com.defold.push.Push$1.run(Push.java:177) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7050) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

and
E/defold: ERROR:PUSHEXTEXTERNAL: HandleRegistrationResult: FirebaseApp name [DEFAULT] already exists!

Dependencies :

I tryied without https://github.com/defold/extension-firebase-analytics/archive/1.3.2.zip
but same error.

update, I removed all ‘google’ stuff dependencies : admob, google plys service and firebase librairies,
I still have the same trouble here

any idea ?

Please check how many times you call .initializeApp( method in your native extensions.
Just search for this line .initializeApp( in your project and show me the result.

just one

Ok, then show me code where you call push.register
It seems like you call it more than once.

1 Like


And, is the push.register() function being called more than once?
Put a print(message_id) at the top of the on_message function.

I see only one debug info


1 Like

up, any idea ? :confused:

I will investigate it as soon as I’ve completed my current task (Android Billing 3.0 upgrade). I should be done by tomorrow or the latest Friday.

Could I please ask you to create a ticket in the extension-firebase repository?

1 Like

thanks!

good luck with 3.0, of course I can create the ticket

I wasn’t able to find a ticket.

I’ve done quite a bit of testing today and found some issues on Android regarding how Firebase is initialized. I don’t believe the current setup would work very well in combination with other Firebase extensions such as extension-firebase-analytics.

I’ve created a PR that is waiting for review: https://github.com/defold/extension-push/pull/22

The PR has been merged and a new release has been made: https://github.com/defold/extension-push/releases/tag/2.0.0

You now configure push on Android the same way as any other Firebase project; through the Firebase Console and the google-services.json config file.

Hi,
thanks for the fix and updates, and sorry for the delay, big rush at work (got my own digital agency, crazy times…)
i’ll test during my free time soon

1 Like

Hi,

not sure it’s related but i’ve this error :

I tried to remove the dependencie, fetch then add again, but same error.
I also remove .internal and build folders but same.

any idea ?

thanks

same error with others dependencies btw

Which version of the editor are you using?

my bad I was on the beta.

it seems to work with stable release.

I’m build now to test notifications. thanks

it works fine! thank you!

1 Like

Good to hear!