Home > Software design >  Where should I add project level dependencies for firebase in new Android Studio projects
Where should I add project level dependencies for firebase in new Android Studio projects

Time:03-21

I created an Android project from Android Studio Bumblebee and I am trying to integrate Firebase into it. As per the documentation from Firebase, I should add some project level and module level dependencies which are shown below.

When I go to my project level Gradle file it is something like this:

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.6.10' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

So my question is, where should I add these dependencies?

CodePudding user response:

Add the following piece of code

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

CodePudding user response:

Solved it by adding build script in the top

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

// 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.6.10' apply false
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

and the google() repositories mentioned can be excluded as its there by default.

  • Related