Explanation
This error message “plugin with id ‘com.google.gms.google-services’ not found” is commonly encountered in Android projects that use Firebase services. This error typically occurs when the necessary Google Play Services Gradle plugin is missing or misconfigured in the project.
Solution
To resolve the issue, you can follow these steps:
- Open your project in Android Studio.
- Navigate to the
build.gradle
file of the module that is showing the error. This is often the app-levelbuild.gradle
. - Within the
build.gradle
file, locate thedependencies
section. - Add the following line to the dependencies:
classpath 'com.google.gms:google-services:4.3.10'
Here is an example of how the dependencies
section may look like after adding the above line:
dependencies {
//...
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.google.gms:google-services:4.3.10'
//...
}
After adding the above line, click on the “Sync Now” button that appears in the top-right corner of your Android Studio. This will sync the changes and download the necessary Google Play Services Gradle plugin.
If the issue persists, make sure you have the correct version of the Google Play Services Gradle plugin specified in your build.gradle
file. You can find the latest version by checking the Firebase documentation or the official Google Maven repository.