Gradle sync failed: Plugin [id: 'com.android.application', version: '7.1.2', apply: false] was not found in any of the following sources:
Asked Answered
F

11

11

I have upgraded my Android Studio and after that I'm facing this error:

Gradle sync failed: Plugin [id: 'com.android.application', version: '7.1.2', apply: false] was not found in any of the following sources:
                - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
                - Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:7.1.2')
                Searched in the following repositories:
                Gradle Central Plugin Repository
                Google
                MavenRepo (24 s 586 ms)

I have upgraded JDK to 11 but it didn't fix the error. What else can I do?

Fab answered 10/3, 2022 at 16:12 Comment(3)
If you resolved your own problem, please don't edit your question with the solution. Take the solution information and create an answer so that others may see how they can resolve the same problem. Then mark your answer as accepted.Tallent
@Tallent Thank you for the tip. As you can see, I'm new here and I didn't no that.Fab
Check this answer https://mcmap.net/q/1019176/-plugin-id-39-com-android-application-39-version-39-7-3-1-39-apply-false-was-not-found-in-any-of-the-following-sourcesEmber
F
7

Solved:

After trying some other solutions I figured out that I didn't delete proxies in gradle-wrapper.properties. That was preventing my project from downloading dependencies.

Fab answered 11/3, 2022 at 6:47 Comment(1)
it didn't solve my problem.Response
O
3

That happen with the newer gradle versions, Go to Settings -> Plugins -> settings -> HTTP proxy settings then switch it to (auto detect proxy settings) then save and sync the project, that will solve the problem.

Check the images below for quick help

Orthorhombic answered 2/10, 2022 at 14:3 Comment(2)
Please use proper formatting for images.Counteract
This didn't work in my caseGoebel
A
3

The problem happens because there's something wrong with the downloading. You may check your internet connection, your proxy settings, the VPN you're using, or disable 'offline mode' in Gradle -which was the case for me- and that should work for you.

Here's the solution for my case: instructions to disable gradle offline mode

  1. Open the gradle menu at the top right (number 1 in the image).
  2. Disable offline mode (just let the button be the same as the image).

This is NOT a step, it's just to differentiate the enabled button from the disabled one. The button indicated by number 3 in the image is enabled, while the one indicated by number 2 is disabled.

This might not be your case, so make sure you have a proper internet connection and there's nothing blocking it.

I hope this helps you.

Andrus answered 5/12, 2023 at 14:28 Comment(0)
B
1

I came across this issue when updating a project to the latest version of gradle (8.4.1). Adding the following to settings.gradle(Project Settings) resolved the issue:

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
Belier answered 28/5 at 9:4 Comment(0)
P
0

Disconnect the VPN, close and then open Android Studio If you are in Iran or the Netherlands, be sure to use the American or British VPN

Pudendum answered 2/11, 2022 at 7:8 Comment(0)
A
0

This fixed it for me as my company thinks it's cute to use their own certificates as a MitM.

After adding the certificate in File - Settings - Tools - Server Certificates, add something similar to this in your gradle.properties:

-Djavax.net.ssl.trustStore="/path/to/android-studio/jre/lib/security/cacerts" -Djavax.net.ssl.trustStorePassword="yourPassHere"
Alberic answered 5/9, 2023 at 11:58 Comment(0)
W
0

If you are trying to update an old project to a newer version like I do you may face this issue: I updated the app/build.gradle file and add these plugins:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

after that I got this error so after some debugging I figured it out by changing setting.gradle file from:

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

to:

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }
    settings.ext.flutterSdkPath = flutterSdkPath()

    includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }

    plugins {
        id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
}


include ':app'

and it's work.

Weaverbird answered 22/1 at 17:4 Comment(0)
L
0

I'm using this AS

Android Studio Hedgehog | 2023.1.1 Patch 2
Build #AI-231.9392.1.2311.11330709, built on January 18, 2024
Runtime version: 17.0.7+0-b2043.56-10550314 amd64

And I found that this sequence work for me

  1. open Gradle side bar

  2. toggle offline mode

  3. click on Gradle Sync in the App Bar, it should fail..

  4. toggle offline mode again,(should be Online...)

  5. click Gradle Sync Again

in my case, it starts downloading all over again.

the error was pointing to this line

plugins {
    id 'com.android.application' version '7.4.0' apply false

I hope it helps.

Lytta answered 29/1 at 13:35 Comment(0)
E
-1

I faced the same problem when I intentionally updated to gradle 7.1.3 today, I just restarted the android studio and changed the gradle version to 7.1.2 and it worked.

Ellissa answered 7/4, 2022 at 13:52 Comment(0)
E
-1

First update the AndroidStudio, SDK and Plugins to latest.

then In Gradle.properties(Global properties) disable/Comment the below mentioned code.

systemProp.http.proxyHost=192.3.2.1
systemProp.http.proxyPort=8088

build.gradle

plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

finally sync project with gradle files. Issue will be fixed.

Erb answered 29/3, 2023 at 16:57 Comment(0)
C
-3

go tp setting -> then Plugins -> in plugins -> then click on three dot -> then Enable all downloaded plugins

Try this it will definitely work. enter image description here

Clearwing answered 27/3, 2022 at 5:31 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Philomenaphiloo

© 2022 - 2024 — McMap. All rights reserved.