Slackbot
07/11/2022, 10:38 PMephemient
07/11/2022, 10:39 PMColton Idle
07/11/2022, 10:42 PMColton Idle
07/11/2022, 10:42 PMdependencies {
classpath(kotlin("gradle-plugin", version = "1.7.0"))
Martin
07/11/2022, 10:44 PMclasspath
and plugins {}
are in the root build.gradle.kts
, right?)Martin
07/11/2022, 10:45 PMclasspath(kotlin("gradle-plugin", version = "1.7.0")
so that conflict resolution happens correctlyColton Idle
07/11/2022, 11:00 PMMartin
07/11/2022, 11:02 PMclasspath()
. For an example, one of your sample script in the other message has this:
plugins {
id("com.github.ben-manes.versions") version "0.42.0"
}
Martin
07/11/2022, 11:02 PMcom.github.ben-manes.versions
has transitive dependencies that conflict with AGP, they might get loaded separately and crash at runtimeColton Idle
07/11/2022, 11:04 PMclasspath()"
how would I do that?Martin
07/11/2022, 11:05 PMclasspath()
adds the plugin jars to the classpath. This is what I mean by "loading"Martin
07/11/2022, 11:05 PMplugins {
id("com.example")
// or equivalent
id("com.example").apply(true)
}
Colton Idle
07/11/2022, 11:06 PMColton Idle
07/11/2022, 11:07 PMMartin
07/11/2022, 11:07 PMMartin
07/11/2022, 11:07 PMMartin
07/11/2022, 11:08 PMColton Idle
07/11/2022, 11:08 PMColton Idle
07/11/2022, 11:08 PMMartin
07/11/2022, 11:09 PMColton Idle
07/11/2022, 11:10 PMMartin
07/11/2022, 11:12 PMColton Idle
07/11/2022, 11:20 PMColton Idle
07/11/2022, 11:21 PMEli Graber
07/12/2022, 4:17 AMI have a feeling the auto AGP updater added this line. I have no idea how else it would've been added
Can't speak for this particular case, but AS has added code to my root gradle build file related to Kotlin before. Usually without me realizing it, which leads to lots of head scratching.
no
07/12/2022, 7:42 AMMartin
07/12/2022, 9:03 AMplugins {
id("org.jetbrains.kotlin.jvm") version "1.7.0" apply false
}
And
buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
}
}
I understand the plugins {}
block can generate type-safe accessors but that's only if you apply the plugin, right?no
07/12/2022, 9:04 AMThe result is basically the same but usingshould be preferred for consistency, brevity, and readabilityplugins { ... apply false }
Martin
07/12/2022, 9:06 AMcom.android.library
over com.android.application
(or the other way around)Martin
07/12/2022, 9:07 AMcom.android.tools.build:gradle:7.4.0-alpha08
make it explicit that it's only about "loading"Paul Merlin
07/12/2022, 9:09 AM-base
plugin is a good fit in those cases, if available.no
07/12/2022, 9:20 AM