To enable Firebase Crashlytics directly from Android Studio, follow these steps:
Step 1: Open Firebase Assistant in Android Studio
- In Android Studio, go to Tools > Firebase.
- The Firebase Assistant panel will open on the right side of the screen.
- Select Crashlytics under Firebase in the assistant.
Step 2: Add Crashlytics to Your App
- In the Firebase Assistant, click on Crashlytics > Get started with Firebase Crashlytics.
- Click on Connect your app to Firebase. This will link your Android project to Firebase.
- Follow the on-screen prompts to add the Firebase Crashlytics SDK. The assistant will update your Gradle files with the necessary dependencies automatically.
Step 3: Sync Your Project with Gradle Files
- After the Firebase Assistant adds the dependencies, Android Studio will prompt you to sync your project. Click Sync Now.
- Once synced, the dependencies for Crashlytics should be ready in your project.
Step 4: Enable Crashlytics in Firebase Console
- Go to the Firebase Console and select your project.
- Navigate to Crashlytics in the side menu.
- Follow any setup prompts to fully enable Crashlytics for your app if needed.
Step 5: Test Crashlytics
- Run your app to verify that Crashlytics is working. You can add a test crash as shown below:
FirebaseCrashlytics.getInstance().log("Testing Crashlytics")
throw RuntimeException("Test Crash") // Force a crash
- After crashing the app, go to the Firebase Console to see the crash report. It may take a few minutes for it to appear.
With these steps, Crashlytics should be fully enabled in your Android Studio project!