Home

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

Gradle Plugin Portal Version

List of plugins currently available in the repository.

Android plugins

  1. no.nordicsemi.android.plugin.application

    This plugin does the following:

    • applies com.android.application,
    • defines compileSdk, minSdk and targetSdk to values set in AppConsts,
    • sets buildConfig,
    • configures debug and release build types,
    • creates app signing configuration using ../keystore file which is generated by GitHub actions during build.
  2. 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.

  3. no.nordicsemi.android.plugin.library

    This plugin does the following:

    • applies com.android.library,
    • defines compileSdk and minSdk to values set in AppConsts,
    • sets buildConfig,
    • configures debug and release build types.
  4. 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.

  5. no.nordicsemi.android.plugin.kotlin

    This plugin applies org.jetbrains.kotlin.android and configures Kotlin compiler.

  6. no.nordicsemi.android.plugin.hilt

    This plugin applies no.nordicsemi.android.plugin.kotlin and com.google.devtools.ksp and configures Hilt for the module.

  7. 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.

  8. no.nordicsemi.android.plugin.nexus

Creates publish and releaseStagingRepositories tasks using maven-publish.

JVM plugins

  1. no.nordicsemi.jvm.plugin.kotlin (since 2.1)

    This plugin applies org.jetbrains.kotlin.jvm and configures Kotlin compiler.

  2. no.nordicsemi.jvm.plugin.nexus (since 2.0)

    Creates publish and releaseStagingRepositories tasks using maven-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 with plugin.

Version catalog

Maven Central Version

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)
}