এই কুইকস্টার্টটি বর্ণনা করে কিভাবে Firebase Crashlytics SDK ব্যবহার করে আপনার অ্যাপে Firebase Crashlytics সেট আপ করবেন যাতে আপনি Firebase কনসোলে ব্যাপক ক্র্যাশ রিপোর্ট পেতে পারেন।অ্যান্ড্রয়েডের জন্য Crashlytics সাহায্যে, আপনি ক্র্যাশ, অ-মারাত্মক ত্রুটি এবং "অ্যাপ্লিকেশন রেসপন্ডিং নয়" (ANR) ত্রুটির রিপোর্ট পাবেন।
Crashlytics সেট আপ করার জন্য Firebase কনসোল এবং আপনার IDE উভয় ক্ষেত্রেই কাজ করতে হবে (যেমন একটি Firebase কনফিগারেশন ফাইল এবং Crashlytics SDK যোগ করা)। সেটআপ শেষ করতে, আপনার প্রথম ক্র্যাশ রিপোর্ট Firebase-এ পাঠানোর জন্য আপনাকে একটি পরীক্ষামূলক ক্র্যাশ জোর করতে হবে।
শুরু করার আগে
যদি আপনি ইতিমধ্যেই না করে থাকেন, তাহলে আপনার অ্যান্ড্রয়েড প্রোজেক্টে Firebase যোগ করুন । যদি আপনার অ্যান্ড্রয়েড অ্যাপ না থাকে, তাহলে আপনি একটি নমুনা অ্যাপ ডাউনলোড করতে পারেন।
প্রস্তাবিত : ক্র্যাশ, নন-ফ্যাটাল, বা ANR ইভেন্টের দিকে পরিচালিত ব্যবহারকারীর ক্রিয়াগুলি বুঝতে ব্রেডক্রাম্ব লগগুলি স্বয়ংক্রিয়ভাবে পেতে, আপনার Firebase প্রকল্পে Google Analytics সক্ষম করতে হবে।
যদি আপনার বিদ্যমান Firebase প্রকল্পে Google Analytics সক্ষম না থাকে, তাহলে আপনি আপনার Integrations ট্যাব থেকে Google Analytics সক্ষম করতে পারেন
> Firebase কনসোলে প্রজেক্ট সেটিংস । যদি আপনি একটি নতুন Firebase প্রকল্প তৈরি করেন, তাহলে প্রকল্প তৈরির কর্মপ্রবাহের সময় Google Analytics সক্ষম করুন।
আপনার অ্যাপে নিম্নলিখিত ন্যূনতম প্রয়োজনীয় সংস্করণগুলি আছে কিনা তা নিশ্চিত করুন:
- গ্রেডল ৮.০
- অ্যান্ড্রয়েড গ্রেডল প্লাগইন 8.1.0
- গুগল সার্ভিসেস গ্রেডল প্লাগইন ৪.৪.১
ধাপ ১ : আপনার অ্যাপে Crashlytics SDK যোগ করুন
আপনার মডিউল (অ্যাপ-লেভেল) গ্র্যাডেল ফাইলে (সাধারণত<project>/<app-module>/build.gradle.kts অথবা <project>/<app-module>/build.gradle ), অ্যান্ড্রয়েডের জন্য Crashlytics NDK লাইব্রেরির জন্য নির্ভরতা যোগ করুন। লাইব্রেরি সংস্করণ নিয়ন্ত্রণ করতে আমরা Firebase Android BoM ব্যবহার করার পরামর্শ দিই।ব্রেডক্রাম্ব লগের সুবিধা নিতে, আপনার অ্যাপে Google Analytics জন্য ফায়ারবেস SDK যোগ করুন। নিশ্চিত করুন যে আপনার ফায়ারবেস প্রকল্পে গুগল অ্যানালিটিক্স সক্ষম আছে ।
dependencies { // Import the BoM for the Firebase platform implementation(platform("com.google.firebase:firebase-bom:34.4.0")) // Add the dependencies for the Crashlytics NDK and Analytics libraries // When using the BoM, you don't specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-crashlytics-ndk") implementation("com.google.firebase:firebase-analytics") }
Firebase Android BoM ব্যবহার করে, আপনার অ্যাপ সর্বদা Firebase Android লাইব্রেরির সামঞ্জস্যপূর্ণ সংস্করণ ব্যবহার করবে।
(বিকল্প) BoM ব্যবহার না করেই Firebase লাইব্রেরি নির্ভরতা যোগ করুন
যদি আপনি Firebase BoM ব্যবহার না করার সিদ্ধান্ত নেন, তাহলে আপনাকে প্রতিটি Firebase লাইব্রেরি সংস্করণ তার নির্ভরতা লাইনে নির্দিষ্ট করতে হবে।
মনে রাখবেন যে আপনি যদি আপনার অ্যাপে একাধিক Firebase লাইব্রেরি ব্যবহার করেন, তাহলে আমরা দৃঢ়ভাবে লাইব্রেরি সংস্করণগুলি পরিচালনা করার জন্য BoM ব্যবহার করার পরামর্শ দিচ্ছি, যা নিশ্চিত করে যে সমস্ত সংস্করণ সামঞ্জস্যপূর্ণ।
dependencies { // Add the dependencies for the Crashlytics NDK and Analytics libraries // When NOT using the BoM, you must specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-crashlytics-ndk:20.0.3") implementation("com.google.firebase:firebase-analytics:23.0.0") }
ধাপ ২ : আপনার অ্যাপে Crashlytics Gradle প্লাগইন যোগ করুন
আপনার রুট-লেভেল (প্রজেক্ট-লেভেল) গ্র্যাডেল ফাইলে (
<project>/build.gradle.ktsঅথবা<project>/build.gradle)pluginsব্লকে Crashlytics গ্র্যাডেল প্লাগইন যোগ করুন:Kotlin
plugins { // Make sure that you have the AGP plugin 8.1+ dependency id("com.android.application") version "8.1.4" apply false // ... // Make sure that you have the Google services Gradle plugin 4.4.1+ dependency id("com.google.gms.google-services") version "4.4.4" apply false // Add the dependency for the Crashlytics Gradle plugin id("com.google.firebase.crashlytics") version "3.0.6" apply false }
Groovy
plugins { // Make sure that you have the AGP plugin 8.1+ dependency id 'com.android.application' version '8.1.4' apply false // ... // Make sure that you have the Google services Gradle plugin 4.4.1+ dependency id 'com.google.gms.google-services' version '4.4.4' apply false // Add the dependency for the Crashlytics Gradle plugin id 'com.google.firebase.crashlytics' version '3.0.6' apply false }
আপনার মডিউল (অ্যাপ-লেভেল) গ্র্যাডেল ফাইলে (সাধারণত
<project>/<app-module>/build.gradle.ktsঅথবা<project>/<app-module>/build.gradle) Crashlytics Gradle প্লাগইন যোগ করুন:Kotlin
plugins { id("com.android.application") // ... // Make sure that you have the Google services Gradle plugin id("com.google.gms.google-services") // Add the Crashlytics Gradle plugin id("com.google.firebase.crashlytics") }
Groovy
plugins { id 'com.android.application' // ... // Make sure that you have the Google services Gradle plugin id 'com.google.gms.google-services' // Add the Crashlytics Gradle plugin id 'com.google.firebase.crashlytics' }
Step 3 : Force a test crash to finish setup
To finish setting up Crashlytics and see initial data in the Crashlytics dashboard of the Firebase console, you need to force a test crash.
Add code to your app that you can use to force a test crash.
You can use the following code in your app's
MainActivityto add a button to your app that, when pressed, causes a crash. The button is labeled "Test Crash".Kotlin
val crashButton = Button(this) crashButton.text = "Test Crash" crashButton.setOnClickListener { throw RuntimeException("Test Crash") // Force a crash } addContentView(crashButton, ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
Java
Button crashButton = new Button(this); crashButton.setText("Test Crash"); crashButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { throw new RuntimeException("Test Crash"); // Force a crash } }); addContentView(crashButton, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
Build and run your app.
Force the test crash in order to send your app's first crash report:
Open your app from your test device or emulator.
In your app, press the "Test Crash" button that you added using the code above.
After your app crashes, restart it so that your app can send the crash report to Firebase.
Go to the Crashlytics dashboard of the Firebase console to see your test crash.
If you've refreshed the console and you're still not seeing the test crash after five minutes, enable debug logging to see if your app is sending crash reports.
And that's it! Crashlytics is now monitoring your app for crashes, non-fatal errors, and ANRs. Visit the Crashlytics dashboard to view and investigate all your reports and statistics.
পরবর্তী পদক্ষেপ
- Customize your crash report setup by adding opt-in reporting, logs, keys, and tracking of non-fatal errors.
- Integrate with Google Play so that you can filter your Android app's crash reports by Google Play track directly in the Crashlytics dashboard. This allows you to better focus your dashboard on specific builds.
- In Android Studio, view and filter Crashlytics data.
- Use the App Quality Insights (AQI) window in Android Studio to view Crashlytics data alongside your code — no need to jump back and forth between the Crashlytics dashboard and the IDE to start debugging top issues.
- Learn how to use the AQI window in the Android Studio documentation.
- We'd love to hear from you! Send us feedback about the AQI window by filing a bug report .