firebase / firebase/firebase-android-sdk

Do not initialized Crashlytics in unit/instrumented tests

Open
#2,595 1 comment 1 reaction 0 assignees View on GitHub
api: crashlytics type: feature request
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 23h
Merged PRs (30d)
34

Description

## 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)
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the FirebaseOptions.Builder and Firebase.initialize entry points used with InstrumentationRegistry in the issue example. Determine the API behavior needed to prevent Crashlytics initialization in unit and instrumented tests, and verify that existing Firebase initialization still works for normal applications.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.