Hello! Am trying to create a super simple cusotm p...
# gradle
m
Hello! Am trying to create a super simple cusotm plugin in a included build to encapsulate common android setup. But the moment I apply the plugin I got
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.tools.build:gradle:7.2.2.?
Custom plugin :
v
Please don't crop errors
v
It only looks in the plugin central where it seems to not be available. You probably forgot to declare the proper repository like
google()
m
Copy code
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
    versionCatalogs {
        create("libs") {
            from(files("../gradle/libs.versions.toml"))
        }
    }
}
thats the
settings.gradle.kts
file of the included build
even if I add
Copy code
repositories {
        google()
        mavenCentral()
    }
to
build.gralde.kts
I got the same error ­čĄö
more over I can reference android plugin clases in the cusotm plugin so am a bit lost
( The main project where the custom plugin is applied has the repository as well)
v
Both make it available for building the plugin. Building probably was successful, wasn't it? But in the project where you apply the plugin, you have to declare the needed plugin repositories.
Repository configuration does not propagate for very good reasons
m
Copy code
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.2.2")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
        classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.21.0")
        classpath("com.google.gms:google-services:4.3.13")
    }
}
thats the top level build.gradle.kts of the project
dont know where else should I add the google repository
v
That's for resolving build script dependencies of that specific build script, not for plugins and their dependencies and not for sub projects. Declare it in the settings script in plugin management block
m
Cool will try, thanks!