Android
Gradle
Plugin Error
com.android.application
Build Issues

Error1, 0 Plugin with id 'com.android.application' not found

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

The error Plugin with id 'com.android.application' not found means Gradle cannot locate the Android Gradle Plugin (AGP). This typically happens because the plugin repository is not declared in the project-level build.gradle (or settings.gradle for newer projects), the AGP dependency is missing from the buildscript classpath, or there is a version mismatch between AGP and the Gradle wrapper. The fix depends on whether your project uses the legacy buildscript block or the modern plugins DSL.

The Error

 
1* What went wrong:
2Plugin [id: 'com.android.application'] was not found in any of the following sources:
3- Gradle Core Plugins (plugin is not in 'org.gradle')
4- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.2.0')

Fix 1: Legacy buildscript Configuration

groovy
1// project-level build.gradle
2buildscript {
3    repositories {
4        google()          // Required — hosts the Android Gradle Plugin
5        mavenCentral()
6    }
7    dependencies {
8        classpath 'com.android.tools.build:gradle:8.2.0'
9        // For Kotlin projects:
10        // classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22'
11    }
12}
13
14allprojects {
15    repositories {
16        google()
17        mavenCentral()
18    }
19}
groovy
1// app-level build.gradle
2apply plugin: 'com.android.application'
3
4android {
5    compileSdk 34
6    // ...
7}

The google() repository must be in the buildscript.repositories block for Gradle to download the Android plugin.

Fix 2: Modern plugins DSL (AGP 7.0+)

kotlin
1// settings.gradle.kts
2pluginManagement {
3    repositories {
4        google()          // Required for AGP
5        mavenCentral()
6        gradlePluginPortal()
7    }
8}
9
10dependencyResolutionManagement {
11    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
12    repositories {
13        google()
14        mavenCentral()
15    }
16}
17
18rootProject.name = "MyApp"
19include(":app")
kotlin
1// project-level build.gradle.kts
2plugins {
3    id("com.android.application") version "8.2.0" apply false
4    id("com.android.library") version "8.2.0" apply false
5    id("org.jetbrains.kotlin.android") version "1.9.22" apply false
6}
kotlin
1// app-level build.gradle.kts
2plugins {
3    id("com.android.application")
4    id("org.jetbrains.kotlin.android")
5}
6
7android {
8    compileSdk = 34
9    // ...
10}

In the modern setup, repositories are declared in settings.gradle.kts under pluginManagement, and plugin versions are declared in the root build.gradle.kts with apply false.

Fix 3: Gradle Version Compatibility

properties
# gradle/wrapper/gradle-wrapper.properties
# AGP 8.2 requires Gradle 8.2+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
 
1AGP Version | Minimum Gradle Version | Minimum JDK
28.2         | 8.2                    | 17
38.1         | 8.0                    | 17
48.0         | 8.0                    | 17
57.4         | 7.5                    | 11
67.3         | 7.4                    | 11
77.0         | 7.0                    | 11
bash
1# Check current Gradle version
2./gradlew --version
3
4# Update Gradle wrapper
5./gradlew wrapper --gradle-version 8.5

An incompatible Gradle version cannot resolve the AGP plugin, producing the "not found" error.

Fix 4: Network and Proxy Issues

properties
1# gradle.properties — if behind a corporate proxy
2systemProp.http.proxyHost=proxy.example.com
3systemProp.http.proxyPort=8080
4systemProp.https.proxyHost=proxy.example.com
5systemProp.https.proxyPort=8080
6
7# If using a custom Maven repository
8# systemProp.http.proxyUser=username
9# systemProp.http.proxyPassword=password
bash
1# Test if Gradle can reach Google's Maven repository
2curl -I https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/8.2.0/gradle-8.2.0.pom
3
4# Clear Gradle cache and re-download
5rm -rf ~/.gradle/caches/
6./gradlew clean build

Gradle must download the plugin from google() repository. Network issues, firewall rules, or proxy misconfigurations cause download failures.

Fix 5: Check File Structure

 
1MyProject/
2├── build.gradle(.kts)Project-level (declares plugin versions)
3├── settings.gradle(.kts)Declares pluginManagement repositories
4├── gradle.properties
5├── gradle/
6│   └── wrapper/
7│       └── gradle-wrapper.properties
8└── app/
9    └── build.gradle(.kts)Module-level (applies plugins)
bash
1# Common mistake: opening the app/ directory instead of the project root
2# Android Studio should open the directory containing settings.gradle
3
4# Verify the project structure
5ls build.gradle* settings.gradle* app/build.gradle*

Opening the app/ subdirectory directly in Android Studio instead of the project root causes Gradle to miss the project-level configuration.

Common Pitfalls

  • Missing google() repository: The google() repository hosts the Android Gradle Plugin. Without it in buildscript.repositories (legacy) or pluginManagement.repositories (modern), Gradle cannot find the plugin.
  • Opening the wrong directory in Android Studio: Opening the app/ module directory instead of the project root means Gradle does not see the root build.gradle or settings.gradle, causing the plugin resolution to fail.
  • AGP and Gradle version mismatch: Each AGP version requires a specific minimum Gradle version. Using AGP 8.x with Gradle 7.x causes plugin resolution failures. Check the compatibility table.
  • Mixing buildscript and plugins DSL: Using both buildscript { classpath ... } and plugins { id(...) } for the same plugin causes conflicts. Pick one approach and use it consistently.
  • Gradle cache corruption: A failed download can leave corrupted artifacts in ~/.gradle/caches/. Delete the cache directory and rebuild to force a fresh download.

Summary

  • Ensure google() is in buildscript.repositories (legacy) or pluginManagement.repositories (modern)
  • Add classpath 'com.android.tools.build:gradle:VERSION' in the buildscript block, or declare plugin version in root build.gradle.kts
  • Match AGP version to Gradle wrapper version (AGP 8.x needs Gradle 8.x)
  • Open the project root directory in Android Studio, not the app/ subdirectory
  • Clear ~/.gradle/caches/ and rebuild if you suspect cache corruption
  • Check network/proxy settings if Gradle cannot download dependencies

Course illustration
Course illustration

All Rights Reserved.