android studio gradle plugin problems out of the box

Issue

just installed android studio after getting a fresh install of win10. i created a new empety project and got this error:

Gradle sync failed: Plugin [id: ‘com.android.application’, version:
‘7.2.1’, apply: false] was not found in any of the following sources:

this is the code:

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

Edit: the sources were blank and the path to the file is C:\Users\RK33DV\AndroidStudioProjects\test\build.gradle

Solution

The problem is you’re missing settings.gradle file. Try to add settings.gradle file to your project root directory with the following content:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "projectName"
include ':app'

Answered By – Vadik

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published