When I read this doc: https://developers.google.com/android/guides/google-services-plugin they say :
As part of enabling Google APIs or Firebase services in your Android application you may have to add the google-services plugin to
your build.gradle file:dependencies { classpath 'com.google.gms:google-services:4.3.14' // ... }
then they say also :
Add dependencies for basic libraries required for the services you
have enabled. This step requires that you apply the Google Services
Gradle plugin in your app/build.gradle file, like so: apply plugin:
‘com.google.gms.google-services’
so i start a blank new android project in the very last version of android studio and I have for the root 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.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
and in app/build.gradle:
plugins {
id 'com.android.application'
}
android {
namespace 'app.dependencieswalker'
compileSdk 32
defaultConfig {
applicationId "app.dependencieswalker"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "com.alcinoe:alcinoe-firebase:1.0.0"
}
so where I must add the
dependencies {
classpath 'com.google.gms:google-services:4.3.14'
// ...
}
and
apply plugin: 'com.google.gms.google-services' ?
2
Answers
You should modify the root build.gradle as follows:
and the app/build.gradle
In your root
build.gradle
file in theplugins
block addThen apply it in the module
build.gradle
file with: