Plugin [id: 'com.android.application'] was not found in any of the following sources

im getting error in Visual Studio Code.

[{
	"resource": "/c:/Users/ram/vstoredeal_seller/android/app/build.gradle",
	"owner": "_generated_diagnostic_collection_name_#6",
	"code": "0",
	"severity": 8,
	"message": "The supplied phased action failed with an exception.\r\nA problem occurred configuring project ':app'.\r\nBuild file 'C:\\Users\\ram\\vstoredeal_seller\\android\\app\\build.gradle' line: 2\r\nPlugin [id: 'com.android.application'] was not found in any of the following sources:\r\n- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)\r\n- Plugin Repositories (plugin dependency must include a version number for this source)\r\nPlugin [id: 'com.android.application'] was not found in any of the following sources:\r\n- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)\r\n- Plugin Repositories (plugin dependency must include a version number for this source)",
	"source": "Java",
	"startLineNumber": 2,
	"startColumn": 1,
	"endLineNumber": 2,
	"endColumn": 1
}]

build.gradle(app):

plugins {
    id 'com.android.application'
    id 'com.android.library'
    id 'kotlin-android'
    id 'dev.flutter.flutter-gradle-plugin'
    id 'com.google.gms.google-services'
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "com.vstoredeal.seller_in"
    compileSdkVersion 34
    ndkVersion '23.1.7779620'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    allprojects {
        tasks.withType(JavaCompile).tap {
            configureEach {
                options.compilerArgs << "-Xlint:deprecation"
            }
        }
    }

    buildToolsVersion "34.0.0"

    defaultConfig {
        applicationId "com.vstoredeal.seller_in"
        minSdkVersion 23
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}


flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'androidx.activity:activity-ktx:1.9.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.core:core-splashscreen:1.0.1'
    implementation 'androidx.annotation:annotation:1.8.0'
    implementation 'io.flutter:flutter_embedding_debug:1.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'androidx.multidex:multidex:2.0.1'
}

It says you are trying to apply the plugin com.android.application without specifying its version anywhere.

yes but is there any solution for it

if i added the version 8.3.0 it says the com.android.application is not found and it may be with some unknown verssion like that.

once kindly check the following settings.gradle and build.gradle android also whether there may me any issue

settings.gradle:

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-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.3.0" apply false
}

include ":app"
}

build.gradle(android):

buildscript {
    ext.kotlin_version = '1.9.0'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:8.3.0'
        classpath 'com.google.gms:google-services:4.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

You should not have the version in the plugins block and in the buildscript dependencies.
That is redundant and might even lead to yet other problems.

Ok got it Thank you.

1 Like