Hi! I see similar questions, but I did not quite f...
# gradle
f
Hi! I see similar questions, but I did not quite find my answer, so here we go again. I converted our gradle scripts to kotlin, extracting common version constants and logic to
buildSrc
. Now (hopefully) only last thing remains. In the
buildSrc/build.gradle.kts
we have:
Copy code
dependencies {
    implementation("com.android.tools.build:gradle:3.4.1")
}
Then in root project’s
build.gradle.kts
we have:
Copy code
buildscript {
    repositories {
        google()
        ...
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")
        ...
    }
}
Is there a way so that the version
3.4.1
would be specified only in single place? Thanks for any tips.
m
Do you actually need
classpath("com.android.tools.build:gradle:3.4.1")
in your root gradle file ? I've read somewhere that dependencies of
buildSrc
are applied to other build scripts.
1
I've been wanting to try that for some time now
g
As Martin said, you don’t need it in
buildscript.classpath
, it’s already in classpath
f
I tried that, but then the build failed. I’ll post the failure once I have a chance to switch back to my experimental branch.
Ok, so the problem is
Unresolved reference: assembleProvider
, which is weird, because if I comment it out, everything else works.
The problem is that if I define the android gradle plugin in buildscript classpath, i get correct version 3.4.1, but if i define same version in buildSrc, then inside
app/build.gradle.kts
I get
3.2.1
. Any idea why that would happen?
g
How do you apply the plugin? Looks that some other dependency somehow add this dependency. Anyway, it should work, maybe you could reproduce it on some sample
f
Ok, so I tried stripping everything down and found out another plugin was causing the version 3.2.1. For the record, it was https://github.com/timfreiheit/ResourcePlaceholdersPlugin, so even when I removed my dependency on 3.4.1 from buildscripts classpath, this one would include its own on 3.2.1
👍 2