1

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?

StuartDTO
  • 783
  • 7
  • 26
  • 72
  • What is the exact error message gradle shows? It seems ok. – ocos Apr 30 '22 at 12:42
  • That can not find "androidx" looks like this "version" is not the one that I'm using in the `api` but already tried with another name and it doesn't work :/ – StuartDTO May 02 '22 at 10:09
  • Is this an error in IntelliJ/Android Studio, or when you run `./gradlew assemble` from the command line? If so, add the full error from the command line to your question. – aSemy May 03 '22 at 16:16
  • Truth is your setup would 100% work - you are missing something else. It is also important to tell that your approach is bad, there are better approaches involving listing versions outside of *gradle.kts – ror Jul 15 '22 at 19:25

0 Answers0