I need to separate my firebase analytics logs between development/testing and production. I have 2 firebase projects one production and 1 dev. I would like to override the google-services.json file and initialize a difference instance of firebase when on dev. I'm trying to do something like:
if(!((MyApplication)getApplication()).isProd()) {
FirebaseOptions options = new FirebaseOptions.Builder()
.setApplicationId("mypplicationid")
.setApiKey("myKey")
.setDatabaseUrl("myurl").build();
FirebaseApp.initializeApp(this, options);
}
else{
FirebaseApp.initializeApp(this);
}
but the app crashes immediately with FirebaseApp name [DEFAULT] already exists. Is there a way around this besides having 2 google-services.json files and switching them out?
FirebaseAppa name. - Frank van Puffelen