NativeScript / NativeScript/firebase

[firebase 3.2.x] Android "default FirebaseApp is not initialized"

Open
#243 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
62
Forks
53
Avg merge
8d 4h
Merged PRs (30d)
2

Description

CLI: 8.6.5
@nativescript/core: 8.6.2
@nativescript/firebase-analytics: 3.2.2
@nativescript/firebase-core: 3.2.2
@nativescript/firebase-crashlytics: 3.2.2
@nativescript/firebase-messaging: 3.2.2

Were there any breaking changes in the latest versions of firebase-core analytics, crashlytics or messaging? After updating from version 3.1.3 to version 3.2.2 or 3.2.0, I get this error on Android devices:
Error: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.myapp.myapp. Make sure to call FirebaseApp.initializeApp(Context) first.

My code, unchanged from the previous version. initializeApp() returns null and the next line throws the exception.

import { firebase } from "@nativescript/firebase-core";
import "@nativescript/firebase-analytics";
import "@nativescript/firebase-crashlytics";
import "@nativescript/firebase-messaging";

export async function initFirebase() {
    const app = await firebase().initializeApp();
    // app is null

    firebase().crashlytics().setCrashlyticsCollectionEnabled(true);
}

Downgrading to version 3.1.3 all works fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the initFirebase function and compare Firebase Core Android initialization between versions 3.1.3 and 3.2.2. Reproduce the issue with the listed NativeScript and Firebase package versions, then verify that initializeApp() no longer returns null and the subsequent Crashlytics call succeeds on Android.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.