fluttergradleandroid-gradle-pluginbuild.gradlegradle-plugin

Error: Plugin [id: 'com.android.application', version: '8.7.0', apply: false] was not found in any of the following sources


I run flutter run --release:


MacOS 14.4 (Apple Silicon) • Android Studio 2023.2.1 • Java 17 Flutter 3.19.4 • Dart 3.3.2 • DevTools 2.31.1


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
    }()

    includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

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

plugins {
    //id "com.google.gms" version "8.7.0" apply false
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "org.jetbrains.kotlin.android" version "1.9.22" apply false
    id "com.android.application" version "8.7.0" apply false
    //id "com.android.library" version "8.7.0" apply false
}

//rootProject.buildFileName = 'build.gradle.kts'

include ":app"

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

android/build.gradle:

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

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

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

Solution

  • Edit: This post was accurate in March 2024, but is no longer.

    There is no version 8.7.0 for the Android Gradle plugin (Google repo).

    Choose the latest available, 8.3.1:

    id "com.android.application" version "8.3.1" apply false