Skip to main content

Command Palette

Search for a command to run...

React Native Android: Could not find com.android.tools.build:gradle – How to fix it

Updated
3 min read
React Native Android: Could not find com.android.tools.build:gradle – How to fix it
A
I write about React Native, Firebase, Android debugging, and practical lessons from real build and App Check issues. Currently building small tools and resources around error diagnosis.

If you’re working with React Native Android and suddenly see an error like:

  • Could not find com.android.tools.build:gradle:X.X.X

your build will fail immediately, and it’s not always obvious why.

This error usually appears when Gradle cannot locate the Android Gradle Plugin (AGP) required to build your project.

Here’s what’s actually going on—and how to fix it.


What this error means

Gradle is trying to download:

  • com.android.tools.build:gradle

This is the Android Gradle Plugin, which is essential for building Android apps.

If Gradle can’t find it, it means:

👉 it doesn’t know where to look 👉 or it can’t access the repository


1. Check your repositories (most common cause)

Open your root build.gradle file and make sure you have:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
}

👉 The google() repository is especially important, because that’s where the Android Gradle Plugin is hosted.

If it’s missing, Gradle will fail to resolve it.


2. Check your settings.gradle (newer React Native setups)

In newer projects, repositories may also be defined in:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

Make sure google() is included here as well.


3. Verify your Gradle plugin version

In your build.gradle, look for something like:

classpath("com.android.tools.build:gradle:8.x.x")

Make sure:

  • the version exists
  • it’s compatible with your Gradle version

If you’re using a very new or very old version, it might not resolve correctly.


4. Check your internet / proxy setup

This error can also happen if Gradle cannot reach the repository.

Possible causes:

  • no internet connection
  • firewall or proxy blocking access
  • SSL issues

If needed, test connectivity or try a different network.


5. Clean and refresh dependencies

After fixing configuration issues, try:

cd android
./gradlew clean
./gradlew build --refresh-dependencies

This forces Gradle to re-download everything.


6. Watch for environment issues

Sometimes this error appears after:

  • upgrading React Native
  • changing Gradle or Android plugin versions
  • modifying project structure

If that’s the case, double-check that all parts of your setup are aligned.


Final thoughts

“Could not find com.android.tools.build:gradle” usually comes down to one of these:

  • missing google() repository
  • incorrect Gradle configuration
  • version mismatch
  • network issues

Once you know where Gradle is supposed to get the plugin from, the fix becomes much clearer.


Have you run into this?

I’m curious—what caused this error in your case?

Was it a missing repository, or something less obvious?

More from this blog

D

Dev Debugged

21 posts

Step-by-step solutions for coding problems, debugging tips, and practical guides for developers of all levels.