Firebase: Firebase App named '[DEFAULT]' already exists

JavaScript
if (!firebase.apps.length) {
    firebase.initializeApp({});
}if (!firebase.apps.length) {
   firebase.initializeApp({});
}else {
   firebase.app(); // if already initialized, use that one
}

Source

Also in JavaScript: