Android Development
Google Services Plugin
Gradle Error
Build Configuration
Plugin Issues

Plugin with id 'com.google.gms.google-services' not found

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

This Gradle error means the Google Services plugin could not be resolved during build setup. The root cause is usually missing plugin declaration, missing repository configuration, or incompatible Gradle and Android plugin versions. A stable fix requires choosing one plugin-declaration style and aligning all related versions.

Understand the Two Configuration Styles

Android projects typically use one of two valid plugin configuration styles:

  • modern plugins DSL
  • legacy buildscript classpath style

Mixing both incompletely is a common reason the plugin cannot be found.

Modern Plugins DSL Setup

For newer projects, declare plugin versions in root and apply plugin in app module.

settings.gradle:

gradle
1pluginManagement {
2    repositories {
3        google()
4        mavenCentral()
5        gradlePluginPortal()
6    }
7}
8
9dependencyResolutionManagement {
10    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
11    repositories {
12        google()
13        mavenCentral()
14    }
15}

Root build.gradle:

gradle
1plugins {
2    id 'com.android.application' version '8.2.2' apply false
3    id 'com.google.gms.google-services' version '4.4.2' apply false
4}

App module app/build.gradle:

gradle
1plugins {
2    id 'com.android.application'
3    id 'com.google.gms.google-services'
4}

This layout is clean and works well in current toolchains.

Legacy Classpath Setup

If project is still on legacy build layout, define classpath explicitly.

gradle
1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:8.2.2'
8        classpath 'com.google.gms:google-services:4.4.2'
9    }
10}

Then apply plugin in app module:

gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

If classpath exists but app module does not apply plugin, build still fails.

Repository Resolution Must Include Google Maven

The plugin artifact is on Google Maven. Missing google() in plugin management or buildscript repositories will cause resolution failure even if plugin id is correct.

Minimal repository set in relevant scope:

gradle
1repositories {
2    google()
3    mavenCentral()
4}

In restricted network environments, verify proxy and certificate settings for CI agents too.

google-services.json Placement

This error is about plugin resolution, but after fixing it, next failure often comes from missing Firebase config file.

Typical placement:

  • 'app/google-services.json for single app module'
  • variant-specific files for product flavors when needed

Also ensure package name in JSON matches app applicationId for each variant.

Version Compatibility Strategy

Keep these aligned:

  • Gradle wrapper version
  • Android Gradle Plugin version
  • Google Services plugin version
  • Kotlin plugin version if used

Use officially compatible ranges from Android and Firebase release notes. Random upgrades of one component frequently break plugin resolution.

Troubleshooting Sequence

Use a consistent debug order:

  1. verify plugin declaration style in project
  2. verify google() repositories in correct scope
  3. verify plugin version declaration and compatibility
  4. run clean sync and inspect first failing line
  5. verify CI and local environments use same Gradle wrapper

Useful commands:

bash
./gradlew --version
./gradlew tasks --stacktrace

Avoid guessing. Fix the first root error in the build output.

CI Pipeline Alignment

Many teams fix this issue locally and still fail in CI because the pipeline uses a different Gradle wrapper, stale build cache, or restricted repository access. Ensure CI checks out wrapper files from repository, does not override Gradle version unexpectedly, and has outbound access to Google Maven. A reproducible build environment is often the final piece after local configuration looks correct.

Common Pitfalls

  • Mixing plugins DSL and legacy classpath style inconsistently.
  • Declaring plugin in root but never applying it in app module.
  • Missing google() in plugin resolution repositories.
  • Using incompatible versions across Gradle, AGP, and google-services plugin.
  • Fixing local build but forgetting equivalent CI repository and wrapper settings.

Summary

  • The error means Gradle cannot resolve the Google Services plugin id.
  • Pick one configuration style and apply it consistently.
  • Ensure Google Maven repository is configured in correct scope.
  • Align build tool versions across local and CI environments.
  • After plugin resolution, validate google-services.json placement and app id alignment.

Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.