구글 Firebase Document에 나와있지만 한국어로 설정하면 보이지 않는 문제가 있어서 블로그에 포스팅한다. Firebase Crashlytics 통합을 위한 절차는 다음과 같다.
미리 해야 할 일
Firebase에서 프로젝트를 생성하고, google-services.json
파일을 안드로이드 프로젝트에 넣는 작업이 완료된 후 Firebase를 사용 할 준비가 되어있어야 한다. 여기까지의 단계는 (https://firebase.google.com/docs/android/setup[https://firebase.google.com/docs/android/setup]) 에서 따라 할 수 있다.
app/build.gradle
plugins { ... id 'com.google.gms.google-services' id 'com.google.firebase.crashlytics' } dependencies { // - BoM 사용시 출시시점에 FB 라이브러리가 사용가능한 최신버전으로 됨 implementation platform('com.google.firebase:firebase-bom:26.1.1') implementation 'com.google.firebase:firebase-crashlytics' implementation 'com.google.firebase:firebase-analytics' }
project/build.gradle
buildscript { repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository } dependencies { // ... // Add the following line: classpath 'com.google.gms:google-services:4.3.4' // Google Services plugin } } allprojects { // ... repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository // ... } }
프로젝트의 Application 클래스
class BaseApplication : Application() { override fun onCreate() { super.onCreate() // Crashlytics가 Debug 모드에서는 작동하지 않도록 함 FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG) } }
AndroidManifest.xml
방금 만든 BaseApplication 클래스를 연결시켜주면 완성!
<application android:name=".base.BaseApplication" android:icon="@mipmap/ic_launcher" ...> </application>
'프로그래밍 > Android' 카테고리의 다른 글
[안드로이드] 예제로 알아보는 바인드된 서비스 (Bound Service) (0) | 2021.01.18 |
---|---|
[안드로이드] 패키지명(Package name)으로 앱 실행하기 (0) | 2021.01.18 |
[안드로이드] 프로젝트에 Sentry 연동방법, Proguard 적용까지 (0) | 2021.01.12 |
[Kotlin/Java] 생년월일 기준으로 현재 만 나이 계산하기 (0) | 2021.01.11 |
[안드로이드] 주식 봉차트 그리기 (Drawing candle stick chart with MPAndroidChart Library Example) (0) | 2021.01.10 |