Zaheer Ansari
Zaheer Ansari

Reputation: 1009

Could not find com.android.tools.build:gradle:7.3.3. error found in build.gradle file

Could not find com.android.tools.build:gradle:7.3.3.
Searched in the following locations:
  - https://plugins.gradle.org/m2/com/android/tools/build/gradle/7.3.3/gradle-7.3.3.pom
  - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.3.3/gradle-7.3.3.pom
Required by:
    project:

Upvotes: 95

Views: 191675

Answers (12)

Mho. Ajeem Ali
Mho. Ajeem Ali

Reputation: 1

Add the Kotlin standard library with version 1.9.20 explicitly in your dependencies, so it matches the Kotlin version you are using.

In your build.gradle (Module-level) file, add the following: dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.20" } Run this command in your terminal:

./gradlew clean build --refresh-dependencies

Upvotes: 0

Md Mamun Hossain
Md Mamun Hossain

Reputation: 167

Follow the below steps:

  1. Go to File > Settings > Build, Execution, Deployment > Build tools > Gradle
  2. Then change Gradle JDK from the dropdown and select Android Studio java home
  3. Click Apply and/or OK

enter image description here

Upvotes: 14

Leif Liu
Leif Liu

Reputation: 81

Check your build.gradle, make sure repositories has those two items.

    repositories {
        google()
        mavenCentral()
    }

Upvotes: 1

Arun Aditya
Arun Aditya

Reputation: 1104

just check if your internet/wifi is restricting to downloading Gradle. Because for me my office wifi was restricting so switch to my personal mobile data and re-run the project it should automatically download the appropriate gradle version because it worked for me

I got this error after upgrading the Flutter version to 3.10.0 from 3.7.7 since I was using Android studio Electric Ele so above solution was not working for me.

Upvotes: 1

Vikas Pandey
Vikas Pandey

Reputation: 1225

You need to add google in the repositories block in app level build.gradle file: Because android gradle plugin resides on google repository

allprojects {
   repositories {
     google()
     // ...
   }
}

Upvotes: 2

H4k333m
H4k333m

Reputation: 54

For me the Problem was that the project was building fine and producing the apk. But when I run on the command line commands like:

./gradlew clean

I was getting the same error as you.

After many attempt, including even verifying multiple time that I got the right "Gradle JDK (11)" on Android studio, I figured out that maybe the command line fail since it doesn't use the same jdk as the one used by Android studio when I click the "Build Project" button.

I run the command "java -version" on the command line and I found out it was using "openjdk version "1.8.0_362" (Java 1.8) and that I also never set the environment variable $JAVA_HOME in my computer.

So I figured that by installing the Java 11 in my computer "beside the one used by Android studio" and setting as my default would solve the problem.

So I proceeded as such :

sudo yum reinstall java-11-openjdk

After that you can either choose to set the environment variable $JAVA_HOME as pointing to this newly installed JDK 11 or run the command :

sudo update-alternatives --config 'java'

and choose the newly installed JDK 11 from the menu to be your default.

By doing this, my "./gradlew .." command from the terminal works again.

Finally,

The command are given for a Fedora or RHEL based distros, but should easily translate to other distros.

For windows, you can just check that the $JAVA_HOME environment variable is pointing tot he right location.

Upvotes: 2

The Droid Guy
The Droid Guy

Reputation: 177

Go to File -> Settings -> Build,Execution,Deploment -> Build Tools -> Gradle

Then, choose Gradle JDk to 11 Version...

Click Apply -> Okay

Then, Click Try Again on the top to run Gradle Again or you can Rebuild your project.

Upvotes: 15

Georgiy Chebotarev
Georgiy Chebotarev

Reputation: 3180

Changes the Gradle JDK to jdk-11 helped me:

enter image description here

Upvotes: 153

Pradeep Madubashena
Pradeep Madubashena

Reputation: 31

go to File, Settings, Build, Execution, Deployment build tools, gradle Change Gradle JDK from the dropdown. I use Android Studio java home

Upvotes: 3

rifkyadniputra
rifkyadniputra

Reputation: 359

change gradle jdk version worked for me

  • go to File, Settings, Build, Execution, Deployment
  • build tools, gradle
  • Change Gradle JDK from the dropdown. I use Android Studio java home

Upvotes: 23

Hamed Navvabian
Hamed Navvabian

Reputation: 792

I tried gradle 7.4.2 and everything is working fine now

https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

Upvotes: 3

2BAB
2BAB

Reputation: 1423

The "com.android.tools.build:gradle:$version" is what we called Android Gradle Plugin(AGP), its latest stable version is 7.0.4 (until 1st Jan 2022), you can check all available versions here.

The 7.3.3 is for the Gradle platform itself, you can check all available versions here.

For their relationship, please check here.

Upvotes: 87

Related Questions