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.kradle.android-config") version "<version>"
}
kradle {
android {
minSdk = 21
targetSdk = 34
}
}
Then simply apply the respective plugin depending on whether the module is a library or application
Most plugins will also adjust their configuration if the Kotlin Multiplatform plugin is applied
ID | Class | Description |
---|---|---|
io.github.lyxnx.kradle.kotlin-config |
io.github.lyxnx.kradle.kotlin.KotlinConfigPlugin |
Allows configuring of Kotlin properties for the project |
io.github.lyxnx.kradle.kotlin-library |
io.github.lyxnx.kradle.kotlin.KotlinLibraryPlugin |
Applies defaults for a kotlin module |
io.github.lyxnx.kradle.android-config |
io.github.lyxnx.kradle.android.AndroidConfigPlugin |
Allows configuration of Android properties for applications and libraries |
io.github.lyxnx.kradle.android-application |
io.github.lyxnx.kradle.android.AndroidApplicationPlugin |
Configures Android application modules |
io.github.lyxnx.kradle.android-library |
io.github.lyxnx.kradle.android.AndroidLibraryPlugin |
Configures Android library modules |
Provides common configuration for Kotlin modules.
- Applies the
kotlin
plugin - Configures the JVM versions
- Configures test options (JUnit 4/Jupiter (JUnit 5))
Both will:
- Apply the
org.gradle.android.cache-fix
plugin (if added)- If not applied, a warning will be shown that can be suppressed with
kradle.android.suppressCacheFixWarning=true
in yourgradle.properties
- If not applied, a warning will be shown that can be suppressed with
- 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