Firebase Project 생성 후, Firebase에 App을 등록하는 과정 중 "Add Firebase SDK"를 하는 부분이 있다.
Firebase 문서 업데이트가 안되어있는 관계로, Arcticfox(변경 전)에서는 무리없이 따라갈 수 있지만 Bumblebee(변경 후) 에서는 gradle 파일이 다름을 확인할 수 있을 것이다.
해결방법은 아래와 같다.
첫번째, Google services Gradle plugin 추가 (<project>/build.gradle)

해당 이미지에 있는 코드를 project의 build.gradle에 아래 둘중의 한가지 방법으로 추가해주면 된다.
//Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
//1번째 방법. 구글 서비스 추가
//gms와 google 사이 : 쓰지 않도록 주의 (:와 같은 문자 invalid 처리로 인해 오류 발생)
id 'com.google.gms.google-services' version '4.3.13' apply false
}
//2번째 방법. buildscript 자체를 추가
buildscript {
repositories {
google() //Googe's Maven repository
}
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
//Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
두번째, Google services Plugin & Firebase SDKs 추가 (<app-module>build.gradle)

해당 이미지에 있는 코드를 app-module의 build.gradle에 추가해주면 된다.
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services' //구글 서비스 추가
}
android {
//...
}
dependencies { //firebase 의존성 추가
//...
implementation platform('com.google.firebase:firebase-bom:31.0.2')
implementation 'com.google.firebase:firebase-analytics-ktx'
}
'안드로이드 > Kotlin' 카테고리의 다른 글
[안드로이드][Kotlin] Collections (List, Map, Set) (6) | 2023.08.11 |
---|---|
[안드로이드][Kotlin] Scope Functions (Apply, Also, Let, With, Run 함수) (0) | 2023.08.03 |
[안드로이드][Kotlin] Null Safety 와 지연초기화 (0) | 2023.08.03 |
[안드로이드][Kotlin] 액티비티 간의 데이터 전달 (+registerForActivityResult() 사용) (1) | 2023.08.01 |