Gradle build fails saying : Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3

Viewed 2958

I'm building a new project using Android Studio Canary and while setting up dependencies for jet pack compose I get this as build output:

Execution failed for task ':app:processDebugAndroidTestManifest'.
> Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3.
     Required by:
         project :app > androidx.compose.runtime:runtime:1.0.0-beta02

enter image description here

5 Answers

Add jcenter to the repositories of your settings.gradle file. You can specify that it should only be used for this missing artefact. It should look like this:

repositories {
    google()
    mavenCentral()
    //noinspection JcenterRepositoryObsolete
    jcenter {
        content {
            includeModule("org.jetbrains.kotlinx", "kotlinx-collections-immutable-jvm")
        }
    }
}

Based on this thread, I get rid of jcenter from my Jetpack Compose project by:

  1. Modify the dependencies.kt in BuildSrc to add
object Collections {
    private const val version = "0.3.4"
    const val immutable = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:$version"
}
  1. Modify the build.gradle(Module:) to add
implementation Libs.Collections.immutable
  1. Replace jcenter with mavenCentral from
  • build.gradle(Porject:)
  • build.gradle(Module:)
  • build.gradle.kts

I had a spell error and caused the wrong like this, check if you had a spell error. For my case ,I spelled 'org.jetbrains.kotlinx:kotlinx-coroutines-android' to 'org.jetbrains.kotlinx:kotlinx-coroutinesandroid' and caused the build error

Related