Now in Android Application Structure (kts) need to add Parcelable plugin to some modules and features

120 Views Asked by At

I'm using the "Now in Android" multi module application as my "learn by example" base however I've hit another snag from a requirement to my data classes to support Parceable.

As of the moment I need a data class present in core:module:data to be Parcelable, however I am struggling to add the plugin to the module's build.gradle.kts.

Here's what I've tried as per official documentation

  1. in module - build.gradle.kts
plugins {
    alias(libs.plugins.endviscrmux.android.library)
    alias(libs.plugins.endviscrmux.android.library.jacoco)
    alias(libs.plugins.endviscrmux.android.hilt)
    id("kotlinx-serialization")
    id("kotlin-parcelize")
}

android {
    namespace = "co.uk.btcserv.apps.cerpsys.endvis.crm.data"
    testOptions {
        unitTests {
            isIncludeAndroidResources = true
            isReturnDefaultValues = true
        }
    }
}

dependencies {
    implementation(project(":core:common"))
    implementation(project(":core:database"))
    implementation(project(":core:model"))
    implementation(project(":core:network"))
    implementation(project(":core:datastore"))
}
  1. in libs.versions.toml
[versions]
kotlin = "1.9.21"

[libraries]
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }

[plugins]

However, the data class fails to find the @Parcelize annotation required imports.

kindly assist

1

There are 1 best solutions below

1
sheryf On

See my last comment which suggests there's a need to further understand the build-logic : convention's module for it's plugin's usecases