It doesn't seem possible to use the Android Gradle plugins with Gradle's new Version Catalogs feature?
• Not allowed to have a version-less
plugin
declaration in the
toml
file
• Need to put the plugin on the class-path because it's not found with ID alone (e.g:`"com.android.application"`)
• Gradle refuses version specification when plugin is already on the classpath
Catch 22!? Is anyone declaring the
com.android.application / library
plugin with Version Catalogs successfully?
z
Zac Sweers
03/11/2022, 7:57 AM
we’re using it just fine. This is pretty in-actionable without more details (AGP version? why would you not have a version in the toml declaration? etc) or a public repro case
h
hfhbd
03/11/2022, 8:37 AM
I don't use the version catalog, but AGP > 7 finally supports Gradle Metadata. So there is no need for the build script and you can apply the AGP plugin in the plugins block, like every plugin:
Copy code
plugins {
id("com.android.application") version "7.0.4"
kotlin("android") version "1.6.10"
}
repositories {
mavenCentral()
google()
}
And you should use Gradle 7.4, which allows you to apply a plugin in a subproject with the same version defined in the root project, which is done by the version catalog feature under the hood: https://docs.gradle.org/current/release-notes.html
v
Vampire
03/11/2022, 9:05 AM
And even with AGP <7 you don't need the
buildscript
block but can simply do the id=>dependency mapping in the settings script.