skip to Main Content

This is my first time using Android Studio, and I’m trying to run my first Hello World app,
But when I open Android Studio, and it’s trying to build the Gradle, the following error is displayed in Build View:

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

  • Try: Run with –info or –debug option to get more log output. Run with –scan to get full insights.

  • Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: ‘com.android.application’, version: ‘7.1.3’, 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.3’)
    Searched in the following repositories:
    Gradle Central Plugin Repository
    Google
    MavenRepo

build.gradle:

plugins {
    id 'com.android.application' version '7.1.3' apply false
    id 'com.android.library' version '7.1.3' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

settings.gradle:

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

I tried the solution offered here (change the version to 7.1.2),
And also tried to download and set Gradle manually,
But to no avail.

Please enlighten my eyes and tell me what can I do to solve the problem that is happening to me?

3

Answers


  1. Open build.gradle (Module: ‘name of your project.app’)

    At the top, confirm you have the below id in the plugins{...}

    plugins {
        id 'com.android.application'
        ...
    }
    
    Login or Signup to reply.
  2. On Windows, Adding Android Studio to the Windows Firewall list fixed the same problem for me. It wasn’t added by default, or maybe I clicked something wrong during installation.

    • Start > Windows Firewall
    • In the left panel "Allow an app for feature through Windows Firewall"
    • Change settings
    • If Android Studio is not in the list: "Allow another app" and find the exe from the desktop/start menu shortcut
    • I restarted windows; maybe restarting Android Studio is enough

    There are probably many causes/solutions for this error, but this worked for me.

    Login or Signup to reply.
  3. This error is due to Gradle

    open

    C:/user/YouPcUserName/

    and Delete the ./gradle and AndroidStudio folder completely

    Now run Android Studio and it well work

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search