Skip to content

Do not initialized Crashlytics in unit/instrumented tests #2595

Open
@ekselys

Description

@ekselys

What feature would you like to see?

A way to avoid Crahlytics initialization on unit/instrumented tests.
This could be very helpful whenever the crashlytics library is used to across multiple modules (like library modules), avoiding errors like
Caused by: java.lang.IllegalStateException: The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.

How would you use it?

val options = FirebaseOptions.Builder()
            .setApiKey("fake key")
            .setApplicationId("fake app")
            .setProjectId("project id")
            .forTest(true) // do whatever is needed in order to make firebase work in unit/instrumented test 
            // or
            .excludeCrashlytics() // do not include crashlytics on firebase app initialization
            .build()

Firebase.initialize(InstrumentationRegistry.getInstrumentation().context, options)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions