A portmanteau of the words Kotlin and Gradle, this is a group of Gradle plugins that aim to reduce boilerplate for regular JVM and Android modules.
Most plugins accept configuration through their respective extension blocks.
They can also be configured from the root project by applying the *-config
plugins.
For example, to configure the target and minimum SDK for all Android modules:
plugins {
id("io.github.lyxnx.gradle.android-config") version "<version>"
}
kradle {
android {
minSdk.set(21)
targetSdk.set(34)
}
}
Then simply apply the respective plugin depending on whether the module is a library or application
Provides common configuration for Kotlin modules.
- Applies the
kotlin
plugin - Configures the JVM toolchain
- If using Android, AGP will automatically configure the
sourceCompatibility
andtargetCompatibility
based on this value
- If using Android, AGP will automatically configure the
- Configures test options (JUnit 4/Jupiter (JUnit 5))
Both will:
- Apply the
org.gradle.android.cache-fix
plugin (if added to the root build script) - Apply the kotlin plugin
- Configure test options from the aforementioned kotlin plugin
- Set the minimum and target SDKs
- Disable the
aidl
,renderScript
, andshaders
build features
- Apply the AGP
com.android.library
plugin - Disable the
buildConfig
,resValues
, andandroidResources
build features
- Apply the AGP
com.android.application
plugin - Configures the
debug
andrelease
build types