nedmah_9
nedmah_9

Reputation: 21

buildSrc plugins conflict in Android multi-module project using libs.versions.toml

I need a few dependencies in my buildSrc Module to write an extension for project config with, using versions.toml btw

I added buildSrc/settings.gradle.kts:

dependencyResolutionManagement {
    versionCatalogs {
        create("libs") {
            from(files("../gradle/libs.versions.toml"))
        }
    }
}

that's how my build.gradle.kts looks like

plugins {
    `kotlin-dsl`
}

repositories {
    google()
    mavenCentral()
}

dependencies {
    implementation(libs.androidToolsBuildGradle)
    implementation(libs.kotlinGradle)
}

without these deps it build fine, but with them always with an error

Build file 'C:\Users\Admin\AndroidStudioProjects\CryptoScope\build.gradle.kts' line: 2

Error resolving plugin [id: 'com.android.application', version: '8.5.0', apply: false] The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.

Try: 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.

also that is my top-level gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.jetbrains.kotlin.android) apply false
    alias(libs.plugins.kspSymbolProcessing) apply false
    alias(libs.plugins.android.library) apply false
}

also tried a solution that i found on github but it didn't work out.

Error: plugin was not found in any of the following sources.

Upvotes: 2

Views: 42

Answers (1)

Simon Jacobs
Simon Jacobs

Reputation: 6463

You can remove this line from your top-level build.gradle.kts since the same dependency is being added via your buildSrc.

alias(libs.plugins.android.application) apply false

Upvotes: 1

Related Questions