Open aktasmehmet opened 1 year ago
Got the same error.
FATAL EXCEPTION: main Process: test.demo.app.debug:phoenix, PID: 13998
java.lang.RuntimeException: Unable to create application test.demo.app.AppLockApplication: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process test.demo.app.debug:phoenix. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6767)
at android.app.ActivityThread.access$1500(ActivityThread.java:256)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2091)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7870)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process test.demo.app.debug:phoenix. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(FirebaseApp.java:179)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(FirebaseRemoteConfig.java:81)
at com.google.firebase.remoteconfig.ktx.RemoteConfigKt.getRemoteConfig(RemoteConfig.kt:46)
at com.google.sdk_bmik.sd.initConfig(SourceFile:15)
at com.google.sdk_bmik.ka.a(SourceFile:81)
at com.google.sdk_bmik.ka.onCreate(SourceFile:18)
at com.bmik.android.sdk.SDKBaseApplication.onCreate(SourceFile:2)
at test.demo.app.AppLockApplication.onCreate(AppLockApplication.java:141)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1223)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6762)
Fixed with this one @aktasmehmet's Solution
if (!ProcessPhoenix.isPhoenixProcess(this)){
// add the affected code here
}
I've faced the problem when recently I integrated Remote Config of Firebase. After some investigation, it seems that I was already facing this issue after application is re-launched but some of the Firebase libraries were handling the errors in the background. It came to surface when Remote Config caused crashes.
Above works fine when I launch the app normally. Then I call
ProcessPhoenix.triggerRebirth(MyApplication.getContext())
, the app restarts and then crashes with the exception below in line:FirebaseRemoteConfig.getInstance()
.It's just not the Firebase remote config itself. When I remove Remote Config, then I got the exception below in line
MobileAds.initialize(this)
. This time it is well catched by Firebase and the app doesn't crash but error is there.I thought this might be about the singleton init process of Firebase. I've checked the code and saw the method
isPhoenixProcess
which is stated asto prevent running code that is not multi-process ready
. Then I've changed the code to run when it is not a PhoenixProcess and voila! it worked with out any crashes or exceptions.I want to know whether this is a correct approach or there is an issue with the library to fix. Since all of the replies to similar problems on the Internet only points out some gradle plugin issues with Firebase, I wanted to post this to make someone aware :)