build.gradle.kts not recognising object as variable

170 views Asked by At

I have a build.gradle.kts and I'd like to store all the versions there as :

plugins {
    `java-platform`
}

javaPlatform {
    allowDependencies()
}

dependencies {

    val version = object {
    val androidx = object {
        val appCompat = "1.4.1"
        val core = "1.7.0"
    }
    ....

    api("whatever:${version.androidx.appCompat}") <-- not working because can not find "version"

}

When trying to use this version. is not working, any idea why?

0

There are 0 answers