https://kotlinlang.org logo
#android
Title
# android
k

krtko

05/11/2020, 1:54 AM
I've migrate over to Gradle's new
plugins
system and for some reason the Android plugin needs me to add
Copy code
pluginManagement {
    repositories {
        gradlePluginPortal()
        jcenter()
        google()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id.startsWith("com.android")) {
                useModule("com.android.tools.build:gradle:${requested.version}")
            }
        }
    }
}
to my
settings.gradle
file
a

andrewreitz

05/11/2020, 2:02 AM
yeah it’s because they don’t publish to the gradle plugins portal, if you’re not using it on your top level gradle file you can still use the classpath way.
g

gildor

05/11/2020, 2:10 AM
It explained in the official doc, and Android plugin mentioned as an example: https://docs.gradle.org/current/userguide/kotlin_dsl.html#sec:plugins_resolution_strategy
it’s still looks very strange for me, that after all years and reported issues about it there is no solution
a

andrewreitz

05/11/2020, 2:17 AM
oh yeah, it’d be nice if they published it correctly
g

gildor

05/11/2020, 2:22 AM
They at least could publish plugin marker to their own google repo, it’s just a simple text file, so it would allow to get rid of
resolutionStrategy
, only custom repo would be required
Copy code
pluginManagement {
    repositories {
        google()
    }
}
i

itnoles

05/11/2020, 3:11 AM
You make it sounds like easy fix.
g

gildor

05/11/2020, 3:20 AM
publish plugin marker is for sure easy, technically and I don’t see any legal problems
But publishing to Gradle Plugins Portal probably not so easy, not technically, but legally Google doesn’t publish to maven/jcenter, only to own repo
k

krtko

05/11/2020, 5:22 AM
Ya I get not publishing to a "non-google" repo but having to have the resolution strategy seems fixable.
Thanks for the answers btw