0
0
Android Kotlinmobile~10 mins

Crashlytics in Android Kotlin - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Alog
BsetCrashlyticsCollectionEnabled
CrecordException
DsendUnsentReports
Attempts:
3 left
💡 Hint
Common Mistakes
Using log() instead of setCrashlyticsCollectionEnabled()
Calling recordException() without an exception
2fill in blank
medium

Complete 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'
AsetUserId
BrecordException
Clog
DsendUnsentReports
Attempts:
3 left
💡 Hint
Common Mistakes
Using recordException() to log messages
Forgetting to get the Crashlytics instance first
3fill in blank
hard

Fix 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'
ArecordException
Blog
CsetUserId
DsendUnsentReports
Attempts:
3 left
💡 Hint
Common Mistakes
Using log() instead of recordException() for exceptions
Not catching the exception before recording
4fill in blank
hard

Fill 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'
AsetUserId
Blog
CsetCrashlyticsCollectionEnabled
DrecordException
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up log() with setUserId()
Forgetting to enable collection after setting user ID
5fill in blank
hard

Fill 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'
AsetCustomKey
Blog
CrecordException
DsetUserId
Attempts:
3 left
💡 Hint
Common Mistakes
Using setUserId() instead of setCustomKey() for custom data
Logging exceptions instead of recording them