Shared catalogs used in red_mad_robot android team. Gradle 7.4 required.
- androidx - The catalog with AndroidX libraries.
- redmadrobot - The catalog with the red_mad_robot libraries.
- stack - The catalog providing libraries from tech stack used in red_mad_robot android team.
You can read more about shared catalogs usage in the documentation.
You need to create version catalogs in settings.gradle.kts
from remote repository:
dependencyResolutionManagement {
repositories {
mavenCentral()
}
versionCatalogs {
val version = "2023.05.18"
create("rmr") {
from("com.redmadrobot.versions:versions-redmadrobot:$version")
}
create("androidx") {
from("com.redmadrobot.versions:versions-androidx:$version")
}
create("stack") {
from("com.redmadrobot.versions:versions-stack:$version")
}
}
}
โ ๏ธ Be careful with version catalogs naming. Make sure selected name does not conflict with any of Gradle plugin extensions, otherwise your project will not sync. For example, if you have gradle-infrastructure plugin, you cannot create version catalog namedredmadrobot
, because gradle-infrastructure contains an extension namedredmadrobot
. Also you should not name the published version catalog aslibs
if you want to use the local version catalog, or you must rename the local version catalog.
After sync the project gradle create accessors for dependencies like:
plugins {
alias(rmr.plugins.application)
alias(androidx.plugins.navigation.safeargs.kotlin)
}
dependencies {
implementation(androidx.core)
implementation(androidx.fragment)
implementation(rmr.ktx.fragment)
implementation(stack.dagger)
}
You can find Troubleshooting in gradle documentation page.
Caused by: java.lang.IllegalArgumentException: Cannot add extension with name, as there is an extension already registered with that name
Probably, you named a version catalog as one of the gradle plugin extensions. Please, read the warning under Usage section.
Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin request for plugin already on the classpath must not include a version
This exception can occur if the plugin has already been applied in the root build.gradle, or has a notation in the buildscripts section, or has a notation in the plugins section of the settings.gradle file.
You can leave the plugin notation only in the modules you need, because alias
applies the plugin version from the version catalog file.
If this is not possible, you can use the id
extension instead of alias
and get only pluginId from the accessor.
plugins {
id(rmr.plugins.detekt.get().pluginId)
}
This is an Intellij IDEA issue and it does not affect the build.
You can suppress it with @Suppress("DSL_SCOPE_VIOLATION")
Problem: In version catalog libs, you can only import a single external catalog in a given catalog definition.
Probably, you named a published version catalog as libs
.
Please, read the warning under Usage section.
Check your Gradle wrapper version. The current catalog based on Gradle 7.2.
- You can find some useful information and some answers to questions about the version catalog at https://melix.github.io/blog/tags/catalog.html