Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize Firebase Crashlytics in your Android app.
Android Kotlin
val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.[1](true) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using log() instead of setCrashlyticsCollectionEnabled()
Calling recordException() without an exception
✗ Incorrect
The method setCrashlyticsCollectionEnabled() enables or disables Crashlytics data collection.
2fill in blank
mediumComplete the code to log a custom message to Crashlytics.
Android Kotlin
FirebaseCrashlytics.getInstance().[1]("User clicked the button")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using recordException() to log messages
Forgetting to get the Crashlytics instance first
✗ Incorrect
The log() method sends custom log messages to Crashlytics.
3fill in blank
hardFix the error in the code to record an exception in Crashlytics.
Android Kotlin
try { val result = 10 / 0 } catch (e: Exception) { FirebaseCrashlytics.getInstance().[1](e) }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using log() instead of recordException() for exceptions
Not catching the exception before recording
✗ Incorrect
Use recordException() to send caught exceptions to Crashlytics.
4fill in blank
hardFill both blanks to set a user ID and enable Crashlytics collection.
Android Kotlin
val crashlytics = FirebaseCrashlytics.getInstance() crashlytics.[1]("user123") crashlytics.[2](true)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up log() with setUserId()
Forgetting to enable collection after setting user ID
✗ Incorrect
setUserId() assigns a user ID; setCrashlyticsCollectionEnabled(true) enables data collection.
5fill in blank
hardFill all three blanks to create a custom key, log a message, and record an exception.
Android Kotlin
val crashlytics = FirebaseCrashlytics.getInstance() crashlytics.[1]("last_screen", "HomeScreen") crashlytics.[2]("Button clicked") crashlytics.[3](exception)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using setUserId() instead of setCustomKey() for custom data
Logging exceptions instead of recording them
✗ Incorrect
setCustomKey() adds custom data; log() adds messages; recordException() sends exceptions.