Bird
Raised Fist0
Android Kotlinmobile~20 mins

Crashlytics in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Crashlytics Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate
2:00remaining
Crashlytics: What happens when a crash occurs?
In an Android app integrated with Crashlytics, what happens immediately after the app crashes?
AThe app automatically restarts and sends the crash report in the background.
BThe crash report is sent to Firebase immediately, even if the app is closed.
CThe crash report is saved locally and sent the next time the app starts.
DThe crash report is discarded unless the user manually sends it.
Attempts:
2 left
💡 Hint
Think about how Crashlytics handles network availability and app lifecycle.
🧠 Conceptual
intermediate
2:00remaining
Crashlytics: Purpose of custom keys
Why would you add custom keys to Crashlytics reports in your Android app?
ATo add extra information about app state that helps diagnose crashes.
BTo change the priority of crash reports sent to Firebase.
CTo prevent certain crashes from being reported to Firebase.
DTo automatically fix bugs based on the keys provided.
Attempts:
2 left
💡 Hint
Custom keys add context, not control over reporting or fixing.
❓ lifecycle
advanced
2:00remaining
Crashlytics: When to initialize in Android app lifecycle?
Where is the best place to initialize Firebase Crashlytics in an Android app using Kotlin?
AInside the Application class's onCreate() method.
BInside the onDestroy() method of the first activity.
CInside a background thread after user login.
DInside the MainActivity's onStart() method.
Attempts:
2 left
💡 Hint
Crashlytics should be ready as early as possible in app startup.
🔧 Debug
advanced
2:00remaining
Crashlytics: Diagnosing missing crash reports
You integrated Crashlytics but notice some crashes are not appearing in Firebase console. Which of these is the most likely cause?
ACrashlytics requires manual user approval before sending reports.
BYou forgot to add internet permission in AndroidManifest.xml.
CFirebase project is not linked to Google Analytics.
DThe app is running in debug mode and crash reporting is disabled by default.
Attempts:
2 left
💡 Hint
Think about Crashlytics behavior in debug vs release builds.
❓ navigation
expert
2:00remaining
Crashlytics: Handling user consent before crash reporting
Your app requires user consent before sending crash reports. Which approach correctly delays Crashlytics initialization until after consent is given?
Android Kotlin
class MyApp : Application() {
  override fun onCreate() {
    super.onCreate()
    // What to do here?
  }
  fun onUserConsentGiven() {
    // Initialize Crashlytics here
  }
}
ADo not initialize Crashlytics in onCreate(); initialize it only inside onUserConsentGiven() after consent.
BInitialize Crashlytics in onCreate() but disable data collection until consent is given.
CInitialize Crashlytics in onCreate() and remove it if user denies consent.
DInitialize Crashlytics in onCreate() and send crash reports immediately regardless of consent.
Attempts:
2 left
💡 Hint
Crashlytics supports enabling/disabling data collection dynamically.

Practice

(1/5)
1. What is the main purpose of Crashlytics in an Android app?
easy
A. To automatically track and report app crashes
B. To improve app UI design
C. To manage app navigation
D. To optimize app performance speed

Solution

  1. Step 1: Understand Crashlytics functionality

    Crashlytics is a tool designed to detect and report app crashes automatically.
  2. Step 2: Compare options with Crashlytics purpose

    Only To automatically track and report app crashes matches the core function of Crashlytics, which is crash tracking and reporting.
  3. Final Answer:

    To automatically track and report app crashes -> Option A
  4. Quick Check:

    Crashlytics = crash tracking [OK]
Hint: Crashlytics = crash reports automatically [OK]
Common Mistakes:
  • Confusing Crashlytics with UI or navigation tools
  • Thinking Crashlytics improves app speed
  • Assuming Crashlytics manages app content
2. Which of the following is the correct way to add Crashlytics dependency in your app's build.gradle file?
easy
A. apply plugin: 'com.google.firebase.crashlytics'
B. compile 'com.google.firebase:firebase-crashlytics:18.3.7'
C. implementation 'com.google.firebase:firebase-analytics:18.3.7'
D. implementation 'com.google.firebase:firebase-crashlytics:18.3.7'

Solution

  1. Step 1: Identify correct dependency syntax

    Modern Gradle uses 'implementation' to add dependencies, not 'compile' which is deprecated.
  2. Step 2: Match Crashlytics dependency artifact

    The correct artifact for Crashlytics is 'firebase-crashlytics', not 'firebase-analytics'.
  3. Final Answer:

    implementation 'com.google.firebase:firebase-crashlytics:18.3.7' -> Option D
  4. Quick Check:

    Use implementation + firebase-crashlytics [OK]
Hint: Use 'implementation' with firebase-crashlytics artifact [OK]
Common Mistakes:
  • Using deprecated 'compile' keyword
  • Confusing Crashlytics with Analytics dependency
  • Using plugin apply instead of dependency line
3. Given this Kotlin code snippet, what will Crashlytics record when the app crashes?
try {
  val result = 10 / 0
} catch (e: Exception) {
  Firebase.crashlytics.recordException(e)
}
medium
A. Crashlytics records the division by zero exception
B. No crash recorded because exception is caught
C. App will crash without any report
D. Crashlytics records a null pointer exception

Solution

  1. Step 1: Analyze exception handling

    The division by zero throws an ArithmeticException, which is caught in the catch block.
  2. Step 2: Check Crashlytics exception recording

    The caught exception is passed to Firebase.crashlytics.recordException(e), so Crashlytics logs it even without app crash.
  3. Final Answer:

    Crashlytics records the division by zero exception -> Option A
  4. Quick Check:

    recordException logs caught exceptions [OK]
Hint: recordException logs caught errors even if app doesn't crash [OK]
Common Mistakes:
  • Thinking caught exceptions are ignored by Crashlytics
  • Assuming app crashes without report
  • Confusing exception types
4. You added Crashlytics to your app but no crash reports appear in the Firebase console. What is a common mistake causing this?
medium
A. Adding Crashlytics dependency in the wrong module
B. Using the wrong package name in build.gradle
C. Not initializing Firebase in the Application class
D. Calling recordException outside a try-catch block

Solution

  1. Step 1: Check Firebase initialization

    Firebase must be initialized early, usually in the Application class, for Crashlytics to work.
  2. Step 2: Evaluate other options

    Wrong package name or dependency module can cause issues but the most common is missing Firebase initialization.
  3. Final Answer:

    Not initializing Firebase in the Application class -> Option C
  4. Quick Check:

    Initialize Firebase early for Crashlytics [OK]
Hint: Always initialize Firebase in Application class [OK]
Common Mistakes:
  • Forgetting FirebaseApp.initializeApp(context)
  • Misplacing dependencies in modules
  • Assuming recordException needs try-catch
5. You want to log a custom message and a user ID to Crashlytics before a crash happens. Which code snippet correctly does this?
hard
A. Firebase.crashlytics.log("User clicked the crash button") throw RuntimeException("Test crash") Firebase.crashlytics.setCustomKey("userId", "12345")
B. Firebase.crashlytics.setCustomKey("userId", "12345") Firebase.crashlytics.log("User clicked the crash button") throw RuntimeException("Test crash")
C. throw RuntimeException("Test crash") Firebase.crashlytics.setCustomKey("userId", "12345")
D. Firebase.crashlytics.recordException(RuntimeException("Test crash")) Firebase.crashlytics.setCustomKey("userId", "12345")

Solution

  1. Step 1: Understand Crashlytics logging order

    Custom keys and logs must be set before the crash to be included in the report.
  2. Step 2: Check code snippet order

    Firebase.crashlytics.setCustomKey("userId", "12345") Firebase.crashlytics.log("User clicked the crash button") throw RuntimeException("Test crash") sets the user ID and logs the message before throwing the crash, so data is captured correctly.
  3. Final Answer:

    Set custom key and log before crash throw -> Option B
  4. Quick Check:

    Set keys and logs before crash [OK]
Hint: Set keys/logs before crash throw to capture data [OK]
Common Mistakes:
  • Setting keys after crash throw (too late)
  • Using recordException instead of throwing crash
  • Not logging custom messages
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard