Android Grade could not resolve androidx.room:room-runtime:2.4.2

Viewed 866

I am trying to upgrade this Modular project to latest dependencies but gradle build fails with could not resolve androidx.room:room-runtime:2.4.2 I have aleady included mavenCentral() to repositories but doesn't seem to help.

Note: same versions work on different app with monolithic architecture, not sure modular architecture has anything to do with it.

app/build.gradle

buildscript {

repositories {
    google()
    jcenter()
    mavenCentral()
}
dependencies {
    classpath "com.android.tools.build:gradle:${Versions.gradle}"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.nav}"
}
}

buildSrc/build.gradle

plugins {
`kotlin-dsl`
}
repositories {
    jcenter()
    mavenCentral()
}

dependencies.kts

object Versions {
const val kotlin = "1.6.10"
const val gradle = "7.0.2"
const val room = "2.4.2"
...
}

object Libraries {
    const val roomCompiler = "androidx.room:room-compiler:${Versions.room}"
    const val roomRunTime = "androidx.room:room-runtime:${Versions.room}"
    const val roomKtx = "androidx.room:room-ktx:${Versions.room}"
...
}

Here is a link to my Git Repo

Cheers!

1 Answers

I've clone your repository in upgrade branch. It seems the module doesn't get the repository.

It's because your :data:model module is used as plain kotlin project, and it can't implement room library. In fact, many of your module is not registered as Android Library.


If you intent to use the module to setup Android configuration or use android library like room, please implement library plugin in your build.gradle.

I suppose you can implement "com.android.library" to all your modules first, and please for the love of god... do a better gradle configuration for your modules.

Related