Awesome
Nordic Gradle Plugins for Android
The repo contains plugins which are shared between Nordic's Android applications. Now in Android app from Google has been an inspiration for writing Nordic's dedicated plugins.
Plugins
List of plugins currently available in the repository.
Android plugins
-
no.nordicsemi.android.plugin.application
This plugin does the following:
- applies
com.android.application
, - defines
compileSdk
,minSdk
andtargetSdk
to values set inAppConsts
, - sets
buildConfig
, - configures debug and release build types,
- creates app signing configuration using
../keystore
file which is generated by GitHub actions during build.
- applies
-
no.nordicsemi.android.plugin.application.compose
This plugin applies
no.nordicsemi.android.plugin.application
and adds Compose and Material3 dependency.Since version 2.1
enableStrongSkippingMode
is enabled. -
no.nordicsemi.android.plugin.library
This plugin does the following:
- applies
com.android.library
, - defines
compileSdk
andminSdk
to values set inAppConsts
, - sets
buildConfig
, - configures debug and release build types.
- applies
-
no.nordicsemi.android.plugin.library.compose
This plugin applies
no.nordicsemi.android.plugin.library
and adds Compose and Material3 dependency.Since version 2.1
enableStrongSkippingMode
is enabled. -
no.nordicsemi.android.plugin.kotlin
This plugin applies
org.jetbrains.kotlin.android
and configures Kotlin compiler. -
no.nordicsemi.android.plugin.hilt
This plugin applies
no.nordicsemi.android.plugin.kotlin
andcom.google.devtools.ksp
and configures Hilt for the module. -
no.nordicsemi.android.plugin.feature
This plugin applies:
no.nordicsemi.android.plugin.library.compose
no.nordicsemi.android.plugin.hilt
no.nordicsemi.android.plugin.kotlin
and adds dependency to
androidx.hilt.navigation.compose
.
Creates publish
and releaseStagingRepositories
tasks using maven-publish
.
JVM plugins
-
no.nordicsemi.jvm.plugin.kotlin (since 2.1)
This plugin applies
org.jetbrains.kotlin.jvm
and configures Kotlin compiler. -
no.nordicsemi.jvm.plugin.nexus (since 2.0)
Creates
publish
andreleaseStagingRepositories
tasks usingmaven-publish
.
Plugins are released to Gradle Plugins repository and are available by their ids and version number.
[!Note] Version 2.1 altered ids of the plugins by replacing
gradle
withplugin
.
Version catalog
The repository also contains Gradle Version Catalog with toml file. The file is automatically used by gradle to create libs reference in build.gradle.kts files.
Set up
Include the following code in your settings.gradle.kts file:
pluginManagement {
repositories {
mavenLocal()
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenLocal()
google()
mavenCentral()
}
versionCatalogs {
create("libs") {
from("no.nordicsemi.android.gradle:version-catalog:<version>")
}
}
}
Dependencies can be later set using libs
reference in build.gradle.kts files:
plugins {
alias(libs.plugins.android.application) apply false
}
dependencies {
// Example dependency:
implementation(libs.nordic.dfu)
implementation(libs.androidx.compose.material.iconsExtended)
}