Crashing while adding as module using path
After cloning chat-sdk-android, I made one more project with name ChatSdkParent and imported the modules from chat-sdk-android using path and started getting "Make sure to call FirebaseApp.initializeApp(Context) first." error.
Point to not i imported module using path refer here https://stackoverflow.com/questions/32395675/how-to-import-module-without-creating-copy-in-android-studio
troubleshooting i did:
- Searched FirebaseApp in chat-sdk but didn't get anywhere.
- Tried adding FirebaseApp.getInstance(context) in ChatSdkParent Application class ... didn't work same issue
FATAL EXCEPTION: main
Process: guarddoorupdate.app.com.chatsdkparent, PID: 28279
java.lang.RuntimeException: Unable to create application guarddoorupdate.app.com.chatsdkparent.MyApplication: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process guarddoorupdate.app.com.chatsdkparent. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5973)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process guarddoorupdate.app.com.chatsdkparent. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at co.chatsdk.firebase.push.FirebasePushHandler.
Can you share the Chat SDK initialization code you're running in your application onCreate method?
After executing of FirebasePushModule.activateForFirebase(); its crashing
@Override
public void onCreate() {
super.onCreate();
Context context = getApplicationContext();
FirebaseApp.initializeApp(context);
Configuration.Builder builder = new Configuration.Builder(context);
// builder.firebaseRootPath("firebase_v4_web_new_4");
builder.firebaseRootPath("18_02");
ChatSDK.initialize(builder.build());
UserInterfaceModule.activate(context);
FirebaseModule.activate();
FirebaseFileStorageModule.activate();
FirebasePushModule.activateForFirebase();
Log.e("TAG", "oncreate finished");
}
I think you shouldn't call FirebaseApp.initializeApp(context). Have you added this to your Gradle file (link)?
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
working fine thanks, close the issue