I was just going through how to add Firebase to a Kotlin project and came across this document (Firebase documentation).
The file in the documentation looks like below:
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.10' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
Basically the following line needs to be added inside dependencies
:
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
The problem is my build.gradle doesn't look anything like the above and in fact looks like the below:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
So where and how do I add this file in my Android project?
It is new format you can add in your plugins like this
id 'com.google.gms.google-services' version '4.3.10' apply false