[Crash] - java.lang.IllegalStateException: FirebaseApp name [DEFAULT] already exists!

Hi Niotron Community,

Around 2 weeks ago we released a new update for our application, and surprisingly new crash started occuring. I’m positive it’s related with Firebase/ Google Sign In.
We haven’t touched or updated anything regarding Firebase, Google Sign In…etc

It’s worth asking here, if someone can help.

Stack Trace
> Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.roaster.earn.easy/com.niotron.roasterearndeveloping.Roasterearn72.Login}: java.lang.IllegalStateException: FirebaseApp name [DEFAULT] already exists!
> at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3311)
> at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3450)
> at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:5352)
> at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5260)
> at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:69)
> at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
> at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
> at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2049)
> at android.os.Handler.dispatchMessage (Handler.java:107)
> at android.os.Looper.loop (Looper.java:214)
> at android.app.ActivityThread.main (ActivityThread.java:7436)
> at java.lang.reflect.Method.invoke
> at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
> at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:980)
> Caused by java.lang.IllegalStateException: FirebaseApp name [DEFAULT] already exists!
> at com.google.android.gms.common.internal.Preconditions.checkState (com.google.android.gms:play-services-basement@@18.0.0:2)
> at com.google.firebase.FirebaseApp.initializeApp (com.google.firebase:firebase-common@@19.3.0:295)
> at com.google.firebase.FirebaseApp.initializeApp (com.google.firebase:firebase-common@@19.3.0:268)
> at com.google.appinventor.components.runtime.FirebaseCore.a (SourceFile:90)
> at com.google.appinventor.components.runtime.FirebaseCore.StorageBucket (SourceFile:178)
> at java.lang.reflect.Method.invoke
> at gnu.expr.PrimProcedure.apply (PrimProcedure.java:285)
> at gnu.mapping.CallContext.runUntilDone (CallContext.java:234)
> at gnu.mapping.CallContext.runUntilValue (CallContext.java:298)
> at gnu.expr.GenericProc.applyN (GenericProc.java:120)
> at gnu.kawa.reflect.Invoke.applyN (Invoke.java:193)
> at gnu.mapping.ProcedureN.apply3 (ProcedureN.java:48)
> at com.google.youngandroid.runtime.$PcSetAndCoerceProperty$Ex (runtime2545908755305481735.scm:1365)
> at com.google.youngandroid.runtime.setAndCoerceProperty$Ex (runtime2545908755305481735.scm:197)
> at com.niotron.roasterearndeveloping.Roasterearn72.Login.lambda233 (Login.yail:1756)
> at com.niotron.roasterearndeveloping.Roasterearn72.Login$frame.apply0 (Login.yail:15)
> at gnu.expr.ModuleBody.applyN (ModuleBody.java:226)
> at com.niotron.roasterearndeveloping.Roasterearn72.Login$frame.applyN
> at gnu.expr.ModuleMethod.applyN (ModuleMethod.java:216)
> at gnu.kawa.functions.ApplyToArgs.applyN (ApplyToArgs.java:139)
> at gnu.mapping.ProcedureN.apply1 (ProcedureN.java:31)
> at com.niotron.roasterearndeveloping.Roasterearn72.Login.$define (Login.yail:10274)
> at com.google.appinventor.components.runtime.Form.a (SourceFile:398)
> at com.google.appinventor.components.runtime.Form.onCreate (SourceFile:352)
> at com.niotron.roasterearndeveloping.Roasterearn72.Login.onCreate (Login.yail:10005)
> at android.app.Activity.performCreate (Activity.java:7802)
> at android.app.Activity.performCreate (Activity.java:7791)
> at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1306)
> at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3286)

Blocks, that should be related


3
4
5

Even if someone finds anything wrong about our integration method for Google Sign In, it’s worth pointing it out.

More Information:

  • Apparently it’s happening rare, only to some users
  • Occuring only once, after user reaches our Login Screen (Crashes). After this, if same user opens the app again, there is no trace of it
  • Not everyone is getting this. Approximately out of 1000+ Users, only 5-10 Users will experience the crash
  • Just assumption, but this might be related from Niotron end, as we haven’t did any updates in Firebase. (Perhaps Niotron Staff can check and confirm ?)

Thanks for the detailed information, we’ll look into it.

Thanks :+1: