Gradle version error

Plugin [id: 'com.android.application', version: '8.1.4', apply: false] was not found in any of the following sources:
plugins {
    id("com.android.application") version "8.1.4" apply false
    id("org.jetbrains.kotlin.android") version "1.8.10" apply false
}

someone help me ? please

You cut off the most important lines

Build file '/Users/mtd/AndroidStudioProjects/Omr/build.gradle.kts' line: 2

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

As there are no repositories the plugin is searched in, you somehow managed to empty the plugin repositories. By default the Gradle Plugin Portal is in there and only removed automatically if you add another one. Can you show your settings script and a build --scan?

i run --scan this is build report

Build file '/Users/mtd/AndroidStudioProjects/Omr/build.gradle.kts' line: 2

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

i cant upload image because i am a new user

Why should you upload an image? Images are seldom any useful. I asked for your settings script content and and the URL to the build scan. Unfortunately you didn’t provide either.

build.gradle.kts

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
}

android {
    namespace = "com.mtd.omr"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.mtd.omr"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures {
        compose = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.0"
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
}

dependencies {

    implementation("androidx.core:core-ktx:1.13.0")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
    implementation("androidx.activity:activity-compose:1.9.0")
    implementation(platform("androidx.compose:compose-bom:2023.03.00"))
    implementation("androidx.compose.ui:ui")
    implementation("androidx.compose.ui:ui-graphics")
    implementation("androidx.compose.ui:ui-tooling-preview")
    implementation("androidx.compose.material3:material3")
    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.firebase:firebase-auth-ktx:22.3.1")
    implementation("com.google.firebase:firebase-firestore-ktx:24.11.1")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("androidx.camera:camera-core:1.3.3")
    implementation("androidx.compose.ui:ui-geometry-android:1.6.6")
    implementation("com.google.firebase:firebase-storage-ktx:20.3.0")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
    androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-tooling")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
    implementation(platform("com.google.firebase:firebase-bom:32.7.0"))
    implementation ("com.google.android.gms:play-services-mlkit-text-recognition:19.0.0")
    implementation ("androidx.fragment:fragment-ktx:1.6.2")
    implementation("com.google.firebase:firebase-analytics")
    //noinspection GradleCompatible
    //implementation("com.android.support:appcompat-v7:25.3.1")
}

but i open new project and import module opencv then gave the same error

thanks for helping

That’s not the settings script, that’s a build script.

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "Omr"
include(":app")

sory :)))

You defined three plugin repositories, so it does not make too much sense that it searched in none, so It’s like to ask again for the build --scan URL.

Hi,
I have a similar problem, so that I just jump in the thread rather than creating a new one.
I work with Android Studio on Flutter apps. I seem to need to upgrade gradle from 7.3.0 to 8.5. Naturally, I’m not that experienced otherwise I would probably know what to do.

My settings.gradle file is

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.5" apply false
    id "org.jetbrains.kotlin.android" version "1.9.23" apply false
    id "com.google.gms.google-services" version "4.4.1" apply false
    id "com.google.firebase.crashlytics" version "2.9.9" apply false
}

include ":app"

My gradle-wrapper.properties file is

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

After having changed 7.3.0 to 8.5 and 8.5-bin, I ran main.dart and got the following error message

Launching lib\main.dart on SM A705FN in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\Users\PJPAC\Desktop\Dev-Practise\AndroidStudio\dev_flutter\luni_fixing\android\settings.gradle' line: 22

* What went wrong:
Plugin [id: 'com.android.application', version: '8.5', 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:8.5')
  Searched in the following repositories:
    Google
    MavenRepo
    Gradle Central Plugin Repository

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
Error: Gradle task assembleDebug failed with exit code 1

I got almost the same message when in the terminal I ran
\app\android>./gradlew wrapper --gradle version 8.5
The only difference is

* Where:
Settings file 'C:\...\android\settings.gradle' line: 22

This line corresponding to
id “com.android.application” version “8.5” apply false

I can see that C:\Users\PJPAC.gradle\wrapper\dists includes a folder gradle-8.5-bin

I would love to provide the “build --scan URL” you’ve asked mTd ; however, I don’t know how to proceed (I did mentioned that I lack experience) and the 3 terms build/scan/URL are to generic for google to return any relevant answer. Naively, I’ve tried

flutter build --scan

but “scan” is not an option.
Could you please clarify how to proceed to provide you with “build --scan URL” ?
Many Thanks

It is a Gradle argument, not a Flutter argument.
I have no idea how to pass Gradle arguments via Flutter.

Thanks for your reply. With it, I found this link, Build Scans, and I used the command line :

 ./gradlew build --scan

in the IDE’s terminal window. Then, I got the following message

FAILURE: Build failed with an exception.

* What went wrong:
Could not open cp_settings generic class cache for settings file 'C:\...\android\settings.gradle' (C:\Users\PJPAC\.gradle\caches\8.6\scripts\6mum1h2jj9qolatgst2lvh3wg).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s

However, no link was created in contrast of what I was expecting from Part 3: Dependency Management.

Could it be that the scan is only created for specific outcome ?
I’ve located the file 6mum1h2jj9qolatgst2lvh3wg.lock, which I would be happy to transfer you, but I’m not sure it would be of any help.
Any suggestion ?

It is not, the error means you try to start Gradle 8.6 with Java 22, which is not supported: Compatibility Matrix

Thanks !!!
I cannot read from the error message that java22 is being used but it is indeed the case.
Somehow I thought an automated check would be completed but at least now with the Compatibility matrix I’ve a tool to check instead of selecting the last version available.
Thanks again for your super quick feedback.

1 Like

class file major version 66

Means Java 22